From 580e64540382e499c18d66507480361f226f98ef Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 12:31:48 +0530 Subject: [PATCH] Fix ban.js throwing errors --- app/assets/javascripts/moderation/ban.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/moderation/ban.coffee b/app/assets/javascripts/moderation/ban.coffee index 87ec6555..ebb4d7b8 100644 --- a/app/assets/javascripts/moderation/ban.coffee +++ b/app/assets/javascripts/moderation/ban.coffee @@ -1,5 +1,7 @@ -$(document).on "DOMContentLoaded", -> +load = -> parent = $ "#ban-control-super" + return unless parent.length > 0 + parent.find('#_ban').on "change", (event) -> $t = $ this if $t.is(":checked") @@ -56,3 +58,9 @@ $(document).on "DOMContentLoaded", -> console.log jqxhr, status, error showNotification "An error occurred, a developer should check the console for details", false complete: (jqxhr, status) -> + +$(document).on "DOMContentLoaded", -> + load() + +$(document).on "page:load", -> + load()