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" %>