From 75286b016287886d64c4991e59fa4fdf2985ea88 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 23 Oct 2023 08:36:46 +0100 Subject: [PATCH] Put download links on the next line --- .../search_result_caption_component.html.erb | 6 ++--- app/views/logs/_log_list.html.erb | 27 ++++++++++--------- .../search_result_caption_component_spec.rb | 10 +++---- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/components/search_result_caption_component.html.erb b/app/components/search_result_caption_component.html.erb index 8f3d7e5c3..d170922d7 100644 --- a/app/components/search_result_caption_component.html.erb +++ b/app/components/search_result_caption_component.html.erb @@ -1,10 +1,10 @@ <% if searched.present? && filters_count&.positive? %> - <%= count %> <%= item_label.pluralize(count) %> matching search and filters + <%= count %> <%= item_label.pluralize(count) %> matching search and filters
<% elsif searched.present? %> - <%= count %> <%= item_label.pluralize(count) %> matching search + <%= count %> <%= item_label.pluralize(count) %> matching search
<% elsif filters_count&.positive? %> - <%= count %> <%= item_label.pluralize(count) %> matching filters + <%= count %> <%= item_label.pluralize(count) %> matching filters
<% else %> <%= count %> matching <%= item %> <% end %> diff --git a/app/views/logs/_log_list.html.erb b/app/views/logs/_log_list.html.erb index 8d00ee42d..a7f5a08ef 100644 --- a/app/views/logs/_log_list.html.erb +++ b/app/views/logs/_log_list.html.erb @@ -1,19 +1,20 @@

-
- <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", filters_count: applied_filters_count(@filter_type))) %> - <% if logs&.any? %> - <%= govuk_link_to "Download (CSV)", csv_download_url, type: "text/csv", class: "govuk-!-margin-right-4" %> - <% if @current_user.support? %> - <%= govuk_link_to "Download (CSV, codes only)", csv_codes_only_download_url, type: "text/csv", class: "govuk-!-margin-right-4" %> +
+ <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "logs", filters_count: applied_filters_count(@filter_type))) %> + <% if logs&.any? %> + <%= govuk_link_to "Download (CSV)", csv_download_url, type: "text/csv", class: "govuk-!-margin-right-4" %> + <% if @current_user.support? %> + <%= govuk_link_to "Download (CSV, codes only)", csv_codes_only_download_url, type: "text/csv", class: "govuk-!-margin-right-4" %> + <% end %> <% end %> - <% end %> -
-
- <% if logs&.any? && (display_delete_logs?(@current_user, searched, filter_type) || in_organisations_tab?) %> - <%= govuk_link_to "Delete logs", delete_logs_path, class: "app-!-colour-red" %> - <% end %> -
+
+
+
+ <% if logs&.any? && (display_delete_logs?(@current_user, searched, filter_type) || in_organisations_tab?) %> + <%= govuk_link_to "Delete logs", delete_logs_path, class: "app-!-colour-red" %> + <% end %> +

<% logs.map do |log| %> diff --git a/spec/components/search_result_caption_component_spec.rb b/spec/components/search_result_caption_component_spec.rb index fa136d91b..3e6baaada 100644 --- a/spec/components/search_result_caption_component_spec.rb +++ b/spec/components/search_result_caption_component_spec.rb @@ -11,7 +11,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do context "when search and filter results are found" do it "renders table caption including the search results and total" do - expect(result.to_html).to eq("\n 2 users matching search and filters\n\n") + expect(result.to_html).to eq("\n 2 users matching search and filters
\n
\n") end end @@ -19,7 +19,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:filters_count) { nil } it "renders table caption including the search results and total" do - expect(result.to_html).to eq("\n 2 users matching search\n\n") + expect(result.to_html).to eq("\n 2 users matching search
\n
\n") end end @@ -27,7 +27,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:searched) { nil } it "renders table caption including the search results and total" do - expect(result.to_html).to eq("\n 2 users matching filters\n\n") + expect(result.to_html).to eq("\n 2 users matching filters
\n
\n") end end @@ -44,7 +44,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:count) { 0 } it "renders table caption with total count only" do - expect(result.to_html).to eq("\n 0 users matching search and filters\n\n") + expect(result.to_html).to eq("\n 0 users matching search and filters
\n
\n") end end @@ -52,7 +52,7 @@ RSpec.describe SearchResultCaptionComponent, type: :component do let(:count) { 1 } it "renders table caption with total count only" do - expect(result.to_html).to eq("\n 1 user matching search and filters\n\n") + expect(result.to_html).to eq("\n 1 user matching search and filters
\n
\n") end end end