From e8f1d627b18f17ae391e9b541e3e37ae978d3fa0 Mon Sep 17 00:00:00 2001 From: David Gil Date: Fri, 18 Sep 2015 01:25:55 +0200 Subject: [PATCH 1/2] binds the ie alert close link to a cookie that will be checked before showing the alert the next time --- app/assets/javascripts/application.js | 1 + app/assets/javascripts/dropdown.js.coffee | 2 +- app/assets/javascripts/ie_alert.js.coffee | 9 +++++++++ app/views/layouts/application.html.erb | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 app/assets/javascripts/ie_alert.js.coffee diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 94579b490..5664e7303 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -34,6 +34,7 @@ var initialize_modules = function() { App.LocationChanger.initialize(); App.CheckAllNone.initialize(); App.PreventDoubleSubmission.initialize(); + App.IeAlert.initialize(); }; $(function(){ diff --git a/app/assets/javascripts/dropdown.js.coffee b/app/assets/javascripts/dropdown.js.coffee index 0107bdf64..fafa53542 100644 --- a/app/assets/javascripts/dropdown.js.coffee +++ b/app/assets/javascripts/dropdown.js.coffee @@ -1,4 +1,4 @@ App.Dropdown = initialize: -> - $(document).foundation(); \ No newline at end of file + $(document).foundation() diff --git a/app/assets/javascripts/ie_alert.js.coffee b/app/assets/javascripts/ie_alert.js.coffee new file mode 100644 index 000000000..5328b5f3b --- /dev/null +++ b/app/assets/javascripts/ie_alert.js.coffee @@ -0,0 +1,9 @@ +App.IeAlert = + set_cookie_and_hide: (event) -> + event.preventDefault() + $.cookie('ie_alert_closed', 'true', { path: '/', expires: 365 }); + $('.ie-alert-box').remove() + + initialize: -> + $('.ie-alert-box-close-js').on 'click', (event) -> + App.IeAlert.set_cookie_and_hide(event) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 31f1a2367..a4a13e810 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -23,9 +23,9 @@ <%= render 'layouts/header' %>