diff --git a/media/js/glosses_toggle_edit.js b/media/js/glosses_toggle_edit.js index b9932f8ab..fc2a76bd9 100644 --- a/media/js/glosses_toggle_edit.js +++ b/media/js/glosses_toggle_edit.js @@ -252,6 +252,23 @@ function toggle_altern(data) { buttonCell.attr('value', button_contents); } +function toggle_relOriMov(data) { + if ($.isEmptyObject(data)) { + return; + }; + var glossid = data.glossid; + var relOriMov = data.relOriMov; + var hCell = $("#relOriMov_cell_"+glossid); + $(hCell).empty(); + var cell = ""+relOriMov+""; + hCell.html(cell); + + var button_lookup = '#button_' + glossid + '_relOriMov'; + var buttonCell = $(button_lookup); + var button_contents = similar_gloss_fields_labels['relOriMov'] + ': ' + relOriMov; + buttonCell.attr('value', button_contents); +} + function toggle_create_sense(data) { if ($.isEmptyObject(data)) { return; @@ -583,6 +600,20 @@ $(document).ready(function() { }); }); + $('.quick_relOriMov').click(function(e) + { + e.preventDefault(); + var glossid = $(this).attr('value'); + var relOriMov = $(this).attr("data-relOriMov"); + $.ajax({ + url : url + "/dictionary/update/toggle_relOriMov/" + glossid + "/" + relOriMov, + type: 'POST', + data: { 'csrfmiddlewaretoken': csrf_token }, + datatype: "json", + success : toggle_relOriMov + }); + }); + $('.quick_create_sense').click(function(e) { e.preventDefault(); diff --git a/signbank/dictionary/adminviews.py b/signbank/dictionary/adminviews.py index 4dcbcb2e3..c72b7fe13 100755 --- a/signbank/dictionary/adminviews.py +++ b/signbank/dictionary/adminviews.py @@ -6540,7 +6540,7 @@ def get_context_data(self, **kwargs): context['available_tags'] = [tag for tag in Tag.objects.all()] similar_gloss_fields = ['handedness', 'domhndsh', 'subhndsh', 'handCh', 'relatArtic', 'locprim', - 'contType', 'movSh', 'movDir', 'repeat', 'altern'] + 'contType', 'movSh', 'movDir', 'repeat', 'altern', 'relOriMov'] context['similar_gloss_fields'] = json.dumps(similar_gloss_fields) similar_gloss_fields_labels = {} for field in similar_gloss_fields: @@ -6602,6 +6602,12 @@ def get_context_data(self, **kwargs): {'machine_value': 0, 'name': gettext("No")}] context['available_boolean'] = available_boolean + available_relOriMov = [fc for fc in FieldChoice.objects.filter( + field='RelOriMov', machine_value__in=[0, 1]).order_by('machine_value')] + available_relOriMov += [fc for fc in FieldChoice.objects.filter( + field='RelOriMov', machine_value__gt=1).order_by('name')] + context['available_relOriMov'] = available_relOriMov + context['query_parameters'] = json.dumps(self.query_parameters) query_parameters_keys = list(self.query_parameters.keys()) context['query_parameters_keys'] = json.dumps(query_parameters_keys) diff --git a/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html b/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html index 3d11a9fb1..44724daac 100644 --- a/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html +++ b/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html @@ -556,7 +556,14 @@
+ {% for wc in available_relOriMov %} + + {% endfor %} +
+