From d0571328eddfd2c343c86efbf383f674546bf21e Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 5 Dec 2023 10:56:14 +0000 Subject: [PATCH] feat: update support user tab titles and search bar text --- app/helpers/logs_helper.rb | 23 +++++++++++++++++------ app/views/organisations/logs.html.erb | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/helpers/logs_helper.rb b/app/helpers/logs_helper.rb index f1c3760c6..c26921f0c 100644 --- a/app/helpers/logs_helper.rb +++ b/app/helpers/logs_helper.rb @@ -4,12 +4,16 @@ module LogsHelper when "LettingsLogsController" then "lettings" when "SalesLogsController" then "sales" else - case action_name - when "lettings_logs" then "Lettings logs" - when "sales_logs" then "Sales logs" - else - raise "Log type not found for #{controller.class}, #{action_name}" - end + raise "Log type not found for #{controller.class}" + end + end + + def log_type_for_action(action_name) + case action_name + when "lettings_logs" then "lettings" + when "sales_logs" then "sales" + else + raise "Log type not found for #{action_name}" end end @@ -25,6 +29,13 @@ module LogsHelper end end + def search_label_for_action(action_name) + case log_type_for_action(action_name) + when "lettings" then "Search by log ID, tenant code, property reference or postcode" + when "sales" then "Search by log ID, purchaser code or postcode" + end + end + def csv_download_url_for_controller(controller:, search:, codes_only:) case log_type_for_controller(controller) when "lettings" then csv_download_lettings_logs_path(search:, codes_only:) diff --git a/app/views/organisations/logs.html.erb b/app/views/organisations/logs.html.erb index d7dce249a..e516ce153 100644 --- a/app/views/organisations/logs.html.erb +++ b/app/views/organisations/logs.html.erb @@ -1,5 +1,5 @@ <% item_label = format_label(@pagy.count, "logs") %> -<% title = format_title(@searched, "#{log_type_for_controller(controller).capitalize} logs", current_user, item_label, @pagy.count, @organisation.name) %> +<% title = format_title(@searched, "#{log_type_for_action(action_name).capitalize} logs", current_user, item_label, @pagy.count, @organisation.name) %> <% content_for :title, title %> @@ -28,7 +28,7 @@ <%= render partial: "logs/log_filters" %>
- <%= render SearchComponent.new(current_user:, search_label: "Search by log ID, tenant code, property reference or postcode", value: @searched) %> + <%= render SearchComponent.new(current_user:, search_label: search_label_for_action(action_name), value: @searched) %> <%= govuk_section_break(visible: true, size: "m") %> <%= render partial: "logs/log_list", locals: {