Fix update announcement setting bug.

This commit is contained in:
BoHung Chiu 2020-08-03 16:35:08 +08:00
parent 2241862475
commit f531708a5f
1 changed files with 14 additions and 12 deletions

View File

@ -110,18 +110,20 @@
} }
}) })
} }
var approverList = $(".hidden-approver-list"); $(document).ready(function(){
$(".approver-check input").on("click",function(){ var approverList = $(".hidden-approver-list");
var el = $(this); $(".approver-check input").on("click",function(){
if(el.is(":checked")){ var el = $(this);
var t = $("<input type='hidden'>"); if(el.is(":checked")){
t.val(el.val()); var t = $("<input type='hidden'>");
t.attr("name", "announcement_setting[approvers][]"); t.val(el.val());
t.attr("id", "check_" + el.val()); t.attr("name", "announcement_setting[approvers][]");
approverList.append(t); t.attr("id", "check_" + el.val());
}else{ approverList.append(t);
approverList.find("#check_" + el.val()).remove(); }else{
} approverList.find("#check_" + el.val()).remove();
}
})
}) })
</script> </script>
<div id="notification"><%= t("announcement.click_on_submit") %></div> <div id="notification"><%= t("announcement.click_on_submit") %></div>