Browse Source

feat: update support user tab titles and search bar text

pull/2031/head
natdeanlewissoftwire 1 year ago
parent
commit
d0571328ed
  1. 23
      app/helpers/logs_helper.rb
  2. 4
      app/views/organisations/logs.html.erb

23
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:)

4
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" %>
<div class="app-filter-layout__content">
<%= 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: {

Loading…
Cancel
Save