From d8511c0edfd6b704434335a875da403f1c08af37 Mon Sep 17 00:00:00 2001 From: Virginia Dooley <7017118+VirginiaDooley@users.noreply.github.com> Date: Mon, 30 Mar 2026 15:59:56 +0100 Subject: [PATCH 1/2] Fix broken layout for address search results The Turbo Frame properly replaces content when search results return The layout is consistent across mobile and desktop Search results render within the proper container with correct styling The turbo-frame elements display as block elements --- app/assets/stylesheets/application.css | 5 ++ app/views/dashboard/_address_search.html.erb | 46 +++++++++---------- app/views/dashboard/index.html.erb | 12 ++--- .../_representatives_table.html.erb | 14 +++--- 4 files changed, 41 insertions(+), 36 deletions(-) diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 82f1d553..18d64825 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -9,6 +9,11 @@ * Consider organizing styles into separate files for maintainability. */ +/* Ensure turbo-frame elements display as block */ +turbo-frame { + display: block; +} + #map { margin-bottom: 2rem; height: 40vh; diff --git a/app/views/dashboard/_address_search.html.erb b/app/views/dashboard/_address_search.html.erb index a4f6d40b..1b90378d 100644 --- a/app/views/dashboard/_address_search.html.erb +++ b/app/views/dashboard/_address_search.html.erb @@ -1,26 +1,26 @@ - -
-
- <%= form_with url: dashboard_panel_path('address_search'), method: :post, data: { turbo_frame: 'main-panel' }, html: { class: "space-y-4" } do |form| %> -
- <%= form.label :address, "Enter your address", class: "block text-sm font-medium text-gray-700 mb-1" %> - <%= form.text_field :address, placeholder: "e.g., 123 Main St, City, State, Zip Code", class: "w-full py-3 px-4 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", autocomplete: "off" %> -
-
- <%= form.submit "Find My Representatives", class: "inline-flex items-center bg-blue-500 hover:bg-blue-700 text-white font-semibold py-3 px-4 border border-blue-700 rounded-lg text-base sm:text-lg" %> -
- <% end %> - - <%# Support both locals and instance variables for Turbo and non-Turbo renders %> - <% reps = (defined?(representatives) ? representatives : @representatives) %> - <% did_search = (defined?(searched) ? searched : @searched) %> - <% if did_search %> -
-
- <%= render partial: 'representatives_table', locals: { representatives: reps } %> -
-
- <% end %> + +
+
+ <%= form_with url: dashboard_panel_path('address_search'), method: :post, data: { turbo_frame: 'main-panel' }, html: { class: "space-y-4" } do |form| %> +
+ <%= form.label :address, "Enter your address", class: "block text-sm font-medium text-gray-700 mb-1" %> + <%= form.text_field :address, placeholder: "e.g., 123 Main St, City, State, Zip Code", class: "w-full py-3 px-4 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500", autocomplete: "off" %> +
+
+ <%= form.submit "Find My Representatives", class: "inline-flex items-center bg-blue-500 hover:bg-blue-700 text-white font-semibold py-3 px-4 border border-blue-700 rounded-lg text-base sm:text-lg cursor-pointer" %>
+ <% end %>
+ + <%# Support both locals and instance variables for Turbo and non-Turbo renders %> + <% reps = (defined?(representatives) ? representatives : @representatives) %> + <% did_search = (defined?(searched) ? searched : @searched) %> + <% if did_search %> +
+
+ <%= render partial: 'representatives_table', locals: { representatives: reps } %> +
+
+ <% end %> +
diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index b94f2eb9..c9fe11e2 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -1,15 +1,13 @@
-
+
<%= render 'dashboard/home' %>
-
+
<%= render 'dashboard/progress_map' %>
- -
- <%= render 'dashboard/address_search' %> -
-
+
+ <%= render 'dashboard/address_search' %> +
\ No newline at end of file diff --git a/app/views/representatives/_representatives_table.html.erb b/app/views/representatives/_representatives_table.html.erb index 4ec03b4e..b08f5985 100644 --- a/app/views/representatives/_representatives_table.html.erb +++ b/app/views/representatives/_representatives_table.html.erb @@ -1,7 +1,7 @@ <%# app/views/pages/_representatives_table.html.erb %> <% if representatives.present? %> -
- +
+
@@ -11,11 +11,11 @@ - + <% representatives.each do |rep_obj| %> <% rep = rep_obj.is_a?(Hash) ? rep_obj : rep_obj.respond_to?(:data) ? rep_obj.data : {} %> <% initials = rep["name"].to_s.split.size >= 2 ? rep["name"].to_s.split.first[0] + rep["name"].to_s.split.last[0] : rep["name"].to_s[0,2] rescue '??' %> - +
<% if rep["image"] %>
@@ -102,9 +102,11 @@
-
+
↑ Scroll up to search for a different address
<% else %> -

No representatives found.

+
+

No representatives found for this address. Please try a different address.

+
<% end %> From 9b796039138706b4d3c97c109bcf714ddef5bc02 Mon Sep 17 00:00:00 2001 From: Virginia Dooley <7017118+VirginiaDooley@users.noreply.github.com> Date: Mon, 30 Mar 2026 16:09:58 +0100 Subject: [PATCH 2/2] Update Brakeman --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 68bab0f8..344b8ff7 100644 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,7 @@ group :development, :test do gem "debug", platforms: %i[ mri windows ], require: "debug/prelude" # Static analysis for security vulnerabilities [https://brakemanscanner.org/] - gem "brakeman", require: false + gem "brakeman", ">= 8.0", require: false # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/] gem "rubocop-rails-omakase", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 2d097dac..d3349579 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,7 +85,7 @@ GEM bindex (0.8.1) bootsnap (1.18.6) msgpack (~> 1.2) - brakeman (7.1.1) + brakeman (8.0.4) racc builder (3.3.0) capybara (3.40.0) @@ -429,7 +429,7 @@ PLATFORMS DEPENDENCIES activerecord-postgis-adapter bootsnap - brakeman + brakeman (>= 8.0) capybara debug hotwire-spark