From 4e5c8f4903a521c6f77e6f622988841590743828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 15 Jan 2018 23:19:19 +0100 Subject: [PATCH] Added js file for alert --- app/assets/javascripts/application.js | 2 ++ app/assets/javascripts/investment_report_alert.js.coffee | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 app/assets/javascripts/investment_report_alert.js.coffee diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 611ecc546..561825ccc 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -74,6 +74,7 @@ //= require polls //= require sortable //= require table_sortable +//= require investment_report_alert var initialize_modules = function() { App.Comments.initialize(); @@ -115,6 +116,7 @@ var initialize_modules = function() { App.Polls.initialize(); App.Sortable.initialize(); App.TableSortable.initialize(); + App.InvestmentReportAlert.initialize(); }; $(function(){ diff --git a/app/assets/javascripts/investment_report_alert.js.coffee b/app/assets/javascripts/investment_report_alert.js.coffee new file mode 100644 index 000000000..98b239a55 --- /dev/null +++ b/app/assets/javascripts/investment_report_alert.js.coffee @@ -0,0 +1,7 @@ +App.InvestmentReportAlert = + initialize: -> + $('#js-investment-report-alert').on 'click', -> + if this.checked && $('#budget_investment_feasibility_unfeasible').is(':checked') + confirm(this.dataset.alert + "\n" + this.dataset.notFeasibleAlert); + else if this.checked + confirm(this.dataset.alert);