diff --git a/media/js/glosses_toggle_edit.js b/media/js/glosses_toggle_edit.js index 460aff8ce..81d757b2e 100644 --- a/media/js/glosses_toggle_edit.js +++ b/media/js/glosses_toggle_edit.js @@ -167,6 +167,23 @@ function toggle_locprim(data) { buttonCell.attr('value', button_contents); } +function toggle_contType(data) { + if ($.isEmptyObject(data)) { + return; + }; + var glossid = data.glossid; + var contType = data.contType; + var hCell = $("#contType_cell_"+glossid); + $(hCell).empty(); + var cell = ""+contType+""; + hCell.html(cell); + + var button_lookup = '#button_' + glossid + '_contType'; + var buttonCell = $(button_lookup); + var button_contents = similar_gloss_fields_labels['contType'] + ': ' + contType; + buttonCell.attr('value', button_contents); +} + function toggle_movSh(data) { if ($.isEmptyObject(data)) { return; @@ -479,6 +496,20 @@ $(document).ready(function() { }); }); + $('.quick_contType').click(function(e) + { + e.preventDefault(); + var glossid = $(this).attr('value'); + var contType = $(this).attr("data-contType"); + $.ajax({ + url : url + "/dictionary/update/toggle_contType/" + glossid + "/" + contType, + type: 'POST', + data: { 'csrfmiddlewaretoken': csrf_token }, + datatype: "json", + success : toggle_contType + }); + }); + $('.quick_movSh').click(function(e) { e.preventDefault(); diff --git a/signbank/dictionary/adminviews.py b/signbank/dictionary/adminviews.py index 21e8d0121..9ec27a377 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', - 'movSh', 'repeat', 'altern'] + 'contType', 'movSh', 'repeat', 'altern'] context['similar_gloss_fields'] = json.dumps(similar_gloss_fields) similar_gloss_fields_labels = {} for field in similar_gloss_fields: @@ -6580,6 +6580,12 @@ def get_context_data(self, **kwargs): field='Location', machine_value__gt=1).order_by('name')] context['available_locprim'] = available_locprim + available_contType = [fc for fc in FieldChoice.objects.filter( + field='ContactType', machine_value__in=[0, 1]).order_by('machine_value')] + available_contType += [fc for fc in FieldChoice.objects.filter( + field='ContactType', machine_value__gt=1).order_by('name')] + context['available_contType'] = available_contType + available_movSh = [fc for fc in FieldChoice.objects.filter( field='MovementShape', machine_value__in=[0, 1]).order_by('machine_value')] available_movSh += [fc for fc in FieldChoice.objects.filter( diff --git a/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html b/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html index fc8f3af45..d3eaa3088 100644 --- a/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html +++ b/signbank/dictionary/templates/dictionary/admin_batch_edit_view.html @@ -516,6 +516,14 @@
+ {% for wc in available_contType %} + + {% endfor %} +
+