]> git.0d.be Git - django-panik-nonstop.git/blobdiff - nonstop/templates/nonstop/tracks_metadata.html
templates: improve metadata sync between instru and language
[django-panik-nonstop.git] / nonstop / templates / nonstop / tracks_metadata.html
index 75e3854638e0c49b8264db2bade63674bc3e5838..0e38ab54d68fe219c2ffb447da001bede34682be 100644 (file)
@@ -48,9 +48,20 @@ $('table#edit-metadata th').on('click', function() {
   if ($(this)[0].className == 'sabam') propvalue = false;
   $('tbody').find('.' + $(this)[0].className + ' input').prop('checked', propvalue);
 });
+
+$('input[type=radio][name^=lang-]').on('change', function() {
+  var $instru = $(this).parents('tr').find('input[type=checkbox][name^=instru]');
+  if (($(this).val() == 'na' && ! $instru.is(':checked')) ||
+      ($(this).val() != 'na' && $instru.is(':checked'))) {
+    $instru.trigger('click');
+  }
+});
+
 $('input[type=checkbox][name^=instru]').on('change', function() {
   if ($(this).is(':checked')) {
     $(this).parents('tr').find('input[name^=lang][value=na]').trigger('click');
+  } else {
+    $(this).parents('tr').find('input[name^=lang]').prop('checked', false);
   }
 });
 </script>