From f224e5f503ca6b2dab25b2cfbcf036d33e2e43ec Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Mon, 4 Dec 2023 15:27:44 +0000 Subject: [PATCH] faet: update page titles --- app/helpers/logs_helper.rb | 14 ++++++++++++++ app/views/logs/index.html.erb | 2 +- app/views/organisations/logs.html.erb | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/helpers/logs_helper.rb b/app/helpers/logs_helper.rb index 23a854cde..12bca5d24 100644 --- a/app/helpers/logs_helper.rb +++ b/app/helpers/logs_helper.rb @@ -8,6 +8,20 @@ module LogsHelper end end + def page_title + case controller.class.name + when "LettingsLogsController" then "Lettings logs" + when "SalesLogsController" then "Sales logs" + 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 + end + end + def bulk_upload_options(bulk_upload) array = bulk_upload ? [bulk_upload.id] : [] array.index_with { |_bulk_upload_id| "With logs from bulk upload" } diff --git a/app/views/logs/index.html.erb b/app/views/logs/index.html.erb index 6d1a886f0..edc87d562 100644 --- a/app/views/logs/index.html.erb +++ b/app/views/logs/index.html.erb @@ -1,5 +1,5 @@ <% item_label = format_label(@pagy.count, "logs") %> -<% title = format_title(@searched, "Logs", current_user, item_label, @pagy.count, nil) %> +<% title = format_title(@searched, page_title, current_user, item_label, @pagy.count, nil) %> <% content_for :title, title %> diff --git a/app/views/organisations/logs.html.erb b/app/views/organisations/logs.html.erb index b0a04745c..d84a2c2d8 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, "Logs", current_user, item_label, @pagy.count, @organisation.name) %> +<% title = format_title(@searched, page_title, current_user, item_label, @pagy.count, @organisation.name) %> <% content_for :title, title %>