From 6aada75e1d915c092a9b67fd07dc1fdf49a11a34 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Wed, 29 Nov 2023 10:21:33 +0000 Subject: [PATCH] Split off non-support schemes current nav item checks --- app/helpers/navigation_items_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/navigation_items_helper.rb b/app/helpers/navigation_items_helper.rb index 3d398fd1b..13462eb2b 100644 --- a/app/helpers/navigation_items_helper.rb +++ b/app/helpers/navigation_items_helper.rb @@ -14,7 +14,7 @@ module NavigationItemsHelper [ 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, supported_housing_schemes_current?(path)) if current_user.organisation.holds_own_stock? || current_user.organisation.stock_owners.present?), + (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", 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)), @@ -57,7 +57,11 @@ private end def supported_housing_schemes_current?(path) - path == schemes_path || (path.include?("/organisations") && path.include?("/schemes")) || path.include?("/schemes/") + path == schemes_path || path.include?("/schemes/") + end + + def non_support_supported_housing_schemes_current?(path) + path.starts_with?(organisations_path) && path.include?("/schemes") || path.include?("/schemes/") end def organisations_current?(path)