Browse Source

feat: simplify titles and revert some bulk upload dependent navigation behaviour

pull/2031/head
natdeanlewissoftwire 1 year ago
parent
commit
93672950f0
  1. 2
      app/controllers/organisations_controller.rb
  2. 9
      app/helpers/logs_helper.rb
  3. 6
      app/helpers/navigation_items_helper.rb
  4. 2
      app/views/logs/index.html.erb
  5. 2
      app/views/organisations/logs.html.erb

2
app/controllers/organisations_controller.rb

@ -239,7 +239,7 @@ private
end
def authenticate_scope!
if %w[create new download_lettings_csv email_lettings_csv email_sales_csv download_sales_csv].include? action_name
if %w[create new lettings_logs sales_logs download_lettings_csv email_lettings_csv email_sales_csv download_sales_csv].include? action_name
head :unauthorized and return unless current_user.support?
elsif current_user.organisation != @organisation && !current_user.support?
render_not_found

9
app/helpers/logs_helper.rb

@ -3,15 +3,6 @@ module LogsHelper
case controller.class.name
when "LettingsLogsController" then "lettings"
when "SalesLogsController" then "sales"
else
raise "Log type not found for #{controller.class}"
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"

6
app/helpers/navigation_items_helper.rb

@ -12,9 +12,9 @@ module NavigationItemsHelper
].compact
else
[
NavigationItem.new("Lettings logs", lettings_logs_organisation_path(current_user.organisation), lettings_logs_current?(path)),
NavigationItem.new("Sales logs", sales_logs_organisation_path(current_user.organisation), sales_logs_current?(path)),
(NavigationItem.new("Schemes", schemes_organisation_path(current_user.organisation), non_support_supported_housing_schemes_current?(path)) if current_user.organisation.holds_own_stock? || current_user.organisation.stock_owners.present?),
NavigationItem.new("Lettings logs", lettings_logs_path, lettings_logs_current?(path)),
NavigationItem.new("Sales logs", sales_logs_path, sales_logs_current?(path)),
(NavigationItem.new("Schemes", schemes_path, non_support_supported_housing_schemes_current?(path)) if current_user.organisation.holds_own_stock? || current_user.organisation.stock_owners.present?),
NavigationItem.new("Users", users_organisation_path(current_user.organisation), subnav_users_path?(path)),
NavigationItem.new("About your organisation", details_organisation_path(current_user.organisation.id), subnav_details_path?(path)),
NavigationItem.new("Stock owners", stock_owners_organisation_path(current_user.organisation), stock_owners_path?(path)),

2
app/views/logs/index.html.erb

@ -1,5 +1,5 @@
<% item_label = format_label(@pagy.count, "logs") %>
<% title = format_title(@searched, page_title, current_user, item_label, @pagy.count, nil) %>
<% title = format_title(@searched, "#{log_type_for_controller(controller).capitalize} logs", current_user, item_label, @pagy.count, nil) %>
<% content_for :title, title %>

2
app/views/organisations/logs.html.erb

@ -1,5 +1,5 @@
<% item_label = format_label(@pagy.count, "logs") %>
<% title = format_title(@searched, page_title, current_user, item_label, @pagy.count, @organisation.name) %>
<% title = format_title(@searched, "#{log_type_for_controller(controller).capitalize} logs", current_user, item_label, @pagy.count, @organisation.name) %>
<% content_for :title, title %>

Loading…
Cancel
Save