diff --git a/app/components/view_result_component.html.erb b/app/components/search_result_caption_component.html.erb similarity index 97% rename from app/components/view_result_component.html.erb rename to app/components/search_result_caption_component.html.erb index ed1c4cf29..f011a6b37 100644 --- a/app/components/view_result_component.html.erb +++ b/app/components/search_result_caption_component.html.erb @@ -4,4 +4,4 @@ <% else %> <%= count %> total <%= item %>. <% end %> - \ No newline at end of file + diff --git a/app/components/view_result_component.rb b/app/components/search_result_caption_component.rb similarity index 84% rename from app/components/view_result_component.rb rename to app/components/search_result_caption_component.rb index cc415adde..a6bf9cd63 100644 --- a/app/components/view_result_component.rb +++ b/app/components/search_result_caption_component.rb @@ -1,4 +1,4 @@ -class ViewResultComponent < ViewComponent::Base +class SearchResultCaptionComponent < ViewComponent::Base attr_reader :searched, :count, :item_label, :total_count, :item, :request def initialize(searched:, count:, item_label:, total_count:, item:, request:) diff --git a/app/views/case_logs/_log_list.html.erb b/app/views/case_logs/_log_list.html.erb index 0e6bfda9e..2e5bd5d07 100644 --- a/app/views/case_logs/_log_list.html.erb +++ b/app/views/case_logs/_log_list.html.erb @@ -1,7 +1,7 @@
<%= govuk_table do |table| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular], id: title.dasherize) do |caption| %> - <%= render(ViewResultComponent.new(searched: searched, count: pagy.count, item_label: item_label, total_count: total_count, item: "logs", request: request)) %> + <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", request:)) %> <%= govuk_link_to "Download (CSV)", "/logs.csv", type: "text/csv" %> <% end %> <%= table.head do |head| %> diff --git a/app/views/organisations/_organisation_list.html.erb b/app/views/organisations/_organisation_list.html.erb index fdc997b38..aba82305b 100644 --- a/app/views/organisations/_organisation_list.html.erb +++ b/app/views/organisations/_organisation_list.html.erb @@ -1,8 +1,8 @@
<%= govuk_table do |table| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> - <%= render(ViewResultComponent.new(searched: searched, count: pagy.count, item_label: item_label, total_count: total_count, item: "organisations", request: request)) %> - <% end %> + <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", request:)) %> + <% end %> <%= table.head do |head| %> <%= head.row do |row| %> <% row.cell(header: true, text: "Name", html_attributes: { diff --git a/app/views/schemes/_scheme_list.html.erb b/app/views/schemes/_scheme_list.html.erb index 4103f122e..6bb4af431 100644 --- a/app/views/schemes/_scheme_list.html.erb +++ b/app/views/schemes/_scheme_list.html.erb @@ -1,8 +1,8 @@
<%= govuk_table do |table| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> - <%= render(ViewResultComponent.new(searched: searched, count: pagy.count, item_label: item_label, total_count: total_count, item: "schemes", request: request)) %> - <% end %> + <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", request:)) %> + <% end %> <%= table.head do |head| %> <%= head.row do |row| %> <% row.cell(header: true, text: "Code", html_attributes: { diff --git a/app/views/users/_user_list.html.erb b/app/views/users/_user_list.html.erb index 34d7b12ed..c78600017 100644 --- a/app/views/users/_user_list.html.erb +++ b/app/views/users/_user_list.html.erb @@ -1,8 +1,8 @@
<%= govuk_table do |table| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> - <%= render(ViewResultComponent.new(searched: searched, count: pagy.count, item_label: item_label, total_count: total_count, item: "users", request: request)) %> - <% if current_user.support? %> + <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", request:)) %> + <% if current_user.support? %> <% query = searched.present? ? "?search=#{searched}" : nil %> <%= govuk_link_to "Download (CSV)", "/users.csv#{query}", type: "text/csv" %> <% end %>