From f531708a5f4e40543802c95f0967c30084ed2e50 Mon Sep 17 00:00:00 2001 From: bohung Date: Mon, 3 Aug 2020 16:35:08 +0800 Subject: [PATCH] Fix update announcement setting bug. --- .../admin/announcements/settings.html.erb | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/views/admin/announcements/settings.html.erb b/app/views/admin/announcements/settings.html.erb index 8d66b22..c22115c 100644 --- a/app/views/admin/announcements/settings.html.erb +++ b/app/views/admin/announcements/settings.html.erb @@ -110,18 +110,20 @@ } }) } - var approverList = $(".hidden-approver-list"); - $(".approver-check input").on("click",function(){ - var el = $(this); - if(el.is(":checked")){ - var t = $(""); - t.val(el.val()); - t.attr("name", "announcement_setting[approvers][]"); - t.attr("id", "check_" + el.val()); - approverList.append(t); - }else{ - approverList.find("#check_" + el.val()).remove(); - } + $(document).ready(function(){ + var approverList = $(".hidden-approver-list"); + $(".approver-check input").on("click",function(){ + var el = $(this); + if(el.is(":checked")){ + var t = $(""); + t.val(el.val()); + t.attr("name", "announcement_setting[approvers][]"); + t.attr("id", "check_" + el.val()); + approverList.append(t); + }else{ + approverList.find("#check_" + el.val()).remove(); + } + }) })
<%= t("announcement.click_on_submit") %>