From 61f2954973ef7c769bc1d8841e60c6fc329d0ca1 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 15 Aug 2024 16:50:27 +1000 Subject: [PATCH] Add TurboPower Rails gem for nice helpers The helpers are more convenient but also allow us to add options like smooth scrolling. I thought that looked nicer and is less confusing. Please note that the `scroll_into_view` helper uses the `targets` attribute instead of `target`. That attribute needs CSS selectors with a leading `#` for ids. --- Gemfile | 1 + Gemfile.lock | 3 +++ app/views/admin/reports/create.turbo_stream.haml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6acb4b3825..fb414a745a 100644 --- a/Gemfile +++ b/Gemfile @@ -104,6 +104,7 @@ gem 'sidekiq-scheduler' gem "cable_ready" gem "stimulus_reflex" +gem "turbo_power" gem "turbo-rails" gem 'combine_pdf' diff --git a/Gemfile.lock b/Gemfile.lock index ea4e73580f..5918cc536c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -785,6 +785,8 @@ GEM actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) + turbo_power (0.6.2) + turbo-rails (>= 1.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) @@ -973,6 +975,7 @@ DEPENDENCIES stripe timecop turbo-rails + turbo_power valid_email2 validates_lengths_from_database vcr diff --git a/app/views/admin/reports/create.turbo_stream.haml b/app/views/admin/reports/create.turbo_stream.haml index 4945bb19f9..620d795b24 100644 --- a/app/views/admin/reports/create.turbo_stream.haml +++ b/app/views/admin/reports/create.turbo_stream.haml @@ -2,4 +2,4 @@ = button t(:go), "report__submit-btn", "submit", disabled: true = turbo_stream.update "report-table" do = render "admin/reports/loading" -= turbo_stream.action(:scroll_into_view, "report-table") += turbo_stream.scroll_into_view("#report-table", behavior: "smooth")