From e889c4e2dd4e34a54f798558a4f893c72fa4cc27 Mon Sep 17 00:00:00 2001 From: Caleb Woods Date: Fri, 26 Apr 2024 07:21:58 -0400 Subject: [PATCH 1/3] Fix Goal Table Ensure that works when wrap engine with a middleware for security --- app/components/ahoy_captain/tables/goals_table_component.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/ahoy_captain/tables/goals_table_component.rb b/app/components/ahoy_captain/tables/goals_table_component.rb index 8e54346..5ee6f1b 100644 --- a/app/components/ahoy_captain/tables/goals_table_component.rb +++ b/app/components/ahoy_captain/tables/goals_table_component.rb @@ -5,7 +5,7 @@ class GoalsTableComponent < DynamicTable progress_bar value: :cr, max: 100, title: "Name" do |row| search_params = view_context.search_params query = search_params.dup.merge(q: { goal_in: row.goal_id}).to_query - url = AhoyCaptain::Engine.app.url_helpers.root_path + "?#{query}" + url = AhoyCaptain::Engine.routes.url_helpers.root_path + "?#{query}" link_to row.item.name, url, target: :_top end number :unique_visits, title: "Uniques" From f039487a7cdc01c2022b62cbb4f4366ccfdacd43 Mon Sep 17 00:00:00 2001 From: Caleb Woods Date: Fri, 26 Apr 2024 07:24:39 -0400 Subject: [PATCH 2/3] Fix in view helper --- app/components/ahoy_captain/filter/dropdown_component.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/ahoy_captain/filter/dropdown_component.html.erb b/app/components/ahoy_captain/filter/dropdown_component.html.erb index 80c33b2..462e1af 100644 --- a/app/components/ahoy_captain/filter/dropdown_component.html.erb +++ b/app/components/ahoy_captain/filter/dropdown_component.html.erb @@ -35,7 +35,7 @@
<% end %>
  • - Clear all filters + Clear all filters
  • <% end %> From f4cded647390f48034548f5bc305b1742caf21f2 Mon Sep 17 00:00:00 2001 From: Caleb Woods Date: Fri, 26 Apr 2024 07:30:11 -0400 Subject: [PATCH 3/3] Drop the shim calls and bump importmaps-rails to min requirement to 2 --- ahoy_captain.gemspec | 2 +- app/helpers/ahoy_captain/application_helper.rb | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/ahoy_captain.gemspec b/ahoy_captain.gemspec index c82900a..212441f 100644 --- a/ahoy_captain.gemspec +++ b/ahoy_captain.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.add_dependency "ransack", ">= 2.3" spec.add_dependency "turbo-rails", ">= 1.2" spec.add_dependency "view_component", ">= 3" - spec.add_dependency "importmap-rails", ">= 1" + spec.add_dependency "importmap-rails", ">= 2" spec.add_dependency "stimulus-rails", ">= 1.1" spec.add_dependency "ahoy_matey", ">= 1.1" spec.add_dependency "chartkick", ">= 4" diff --git a/app/helpers/ahoy_captain/application_helper.rb b/app/helpers/ahoy_captain/application_helper.rb index 788dda9..29e397d 100644 --- a/app/helpers/ahoy_captain/application_helper.rb +++ b/app/helpers/ahoy_captain/application_helper.rb @@ -32,13 +32,11 @@ def number_to_duration(duration) end end - def ahoy_captain_importmap_tags(entry_point = "application", shim: true) + def ahoy_captain_importmap_tags(entry_point = "application") safe_join [ - (javascript_importmap_shim_tag if shim), - (javascript_importmap_shim_nonce_configuration_tag if shim), + javascript_inline_importmap_tag(AhoyCaptain.importmap.to_json(resolver: self)), javascript_import_module_tag(entry_point), javascript_importmap_module_preload_tags(AhoyCaptain.importmap), - javascript_inline_importmap_tag(AhoyCaptain.importmap.to_json(resolver: self)), ].compact, "\n" end