You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
1.1 KiB

define(["jquery"],function(a){function b(a,b){a.available.prop("checked")||(a.required.prop("disabled",!0),a.required.prop("checked",!1),b.available.prop("checked")&&(b.required.prop("disabled",!0),b.required.prop("checked",!0),b.requiredHidden.val(1)))}function c(a){a.required.prop("disabled",!1),a.required.prop("checked",!1),a.requiredHidden.val(0)}function d(){b(e.file,e.text),b(e.text,e.file),e.text.available.prop("checked")&&e.file.available.prop("checked")&&(c(e.text),c(e.file))}var e={text:{available:null,required:null,requiredHidden:null},file:{available:null,required:null,requiredHidden:null}};return{init:function(){e.text.available=a("#id_submissiontypetextavailable"),e.text.required=a("#id_submissiontypetextrequired"),e.text.requiredHidden=a('input[name="submissiontypetextrequired"][type="hidden"]'),e.file.available=a("#id_submissiontypefileavailable"),e.file.required=a("#id_submissiontypefilerequired"),e.file.requiredHidden=a('input[name="submissiontypefilerequired"][type="hidden"]'),e.text.available.on("change",d),e.file.available.on("change",d),d()}}});