diff --git a/app/controllers/housing_providers_controller.rb b/app/controllers/housing_providers_controller.rb index 32866fd15..8fd88fb76 100644 --- a/app/controllers/housing_providers_controller.rb +++ b/app/controllers/housing_providers_controller.rb @@ -3,10 +3,15 @@ class HousingProvidersController < ApplicationController include Modules::SearchFilter def index - all_organisations = Organisation.order(:name) - @pagy, @organisations = pagy(filtered_collection(all_organisations, search_term)) - @searched = search_term.presence - @total_count = all_organisations.size + housing_providers = Organisation.order(:name) + respond_to do |format| + format.html do + @pagy, @organisations = pagy(filtered_collection(housing_providers, search_term)) + @searched = search_term.presence + @total_count = housing_providers.size + render "housing_providers/index" + end + end end private diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 0bcb05022..830f7622f 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -136,12 +136,12 @@ class OrganisationsController < ApplicationController end def housing_providers + housing_providers = Organisation.order(:name) respond_to do |format| format.html do - all_organisations = Organisation.order(:name) - @pagy, @organisations = pagy(filtered_collection(all_organisations, search_term)) + @pagy, @organisations = pagy(filtered_collection(housing_providers, search_term)) @searched = search_term.presence - @total_count = all_organisations.size + @total_count = housing_providers.size render "housing_providers", layout: "application" end end diff --git a/app/helpers/navigation_items_helper.rb b/app/helpers/navigation_items_helper.rb index e7c677690..961a94cc0 100644 --- a/app/helpers/navigation_items_helper.rb +++ b/app/helpers/navigation_items_helper.rb @@ -24,7 +24,7 @@ module NavigationItemsHelper FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", sales_logs_path, sales_logs_current?(path)) : nil, NavigationItem.new("Users", users_organisation_path(current_user.organisation), subnav_users_path?(path)), NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", subnav_details_path?(path)), - NavigationItem.new("Housing providers", "/housing-providers", subnav_housing_providers_path?(path)), + NavigationItem.new("Housing providers", "/housing-providers", housing_providers_current?(path)), ].compact end end @@ -77,6 +77,11 @@ private def organisations_current?(path) path == "/organisations" || path.include?("/organisations/") end + + def housing_providers_current?(path) + path == "/housing-providers" + end + def subnav_housing_providers_path?(path) path.include?("/organisations") && path.include?("/housing-providers") end diff --git a/app/views/housing_providers/_housing_provider_list.html.erb b/app/views/housing_providers/_housing_provider_list.html.erb index b848f23f5..45a8ec6f3 100644 --- a/app/views/housing_providers/_housing_provider_list.html.erb +++ b/app/views/housing_providers/_housing_provider_list.html.erb @@ -1,4 +1,3 @@ -
<%= govuk_table do |table| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>