From 8b60b412bafd50b6595e7ad01ffa7966531d8f20 Mon Sep 17 00:00:00 2001 From: noracato Date: Tue, 9 Jul 2024 13:12:20 +0200 Subject: [PATCH] Only init multi year chars js view in new --- app/assets/javascripts/multi_year_charts.js | 4 ---- app/views/multi_year_charts/new.html.haml | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/multi_year_charts.js b/app/assets/javascripts/multi_year_charts.js index 9aa7fb4139..6db905a5fd 100644 --- a/app/assets/javascripts/multi_year_charts.js +++ b/app/assets/javascripts/multi_year_charts.js @@ -25,9 +25,5 @@ } }); - $(function () { - new MultiYearChartNewView({ el: document.querySelector('#new-collection') }).render(); - }); - window.MultiYearChartNewView = MultiYearChartNewView; })(window); diff --git a/app/views/multi_year_charts/new.html.haml b/app/views/multi_year_charts/new.html.haml index e46f87ca44..46cfeeddab 100644 --- a/app/views/multi_year_charts/new.html.haml +++ b/app/views/multi_year_charts/new.html.haml @@ -21,3 +21,5 @@ collection: current_user.saved_scenarios.order(updated_at: :desc).map {|ss| ["#{ss.title}".html_safe, ss.id]} = f.submit t('multi_year_charts.create'), class: 'save button scenario-button' + :javascript + new MultiYearChartNewView({ el: $('#new-collection') }).render()