|
|
@ -9,7 +9,6 @@ module NavigationItemsHelper |
|
|
|
NavigationItem.new("Lettings logs", lettings_logs_path, lettings_logs_current?(path)), |
|
|
|
NavigationItem.new("Lettings logs", lettings_logs_path, lettings_logs_current?(path)), |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", sales_logs_path, sales_logs_current?(path)) : nil, |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", sales_logs_path, sales_logs_current?(path)) : nil, |
|
|
|
NavigationItem.new("Schemes", "/schemes", supported_housing_schemes_current?(path)), |
|
|
|
NavigationItem.new("Schemes", "/schemes", supported_housing_schemes_current?(path)), |
|
|
|
NavigationItem.new("Housing providers", "/housing-providers", housing_providers_current?(path)), |
|
|
|
|
|
|
|
].compact |
|
|
|
].compact |
|
|
|
elsif current_user.data_coordinator? && current_user.organisation.holds_own_stock? |
|
|
|
elsif current_user.data_coordinator? && current_user.organisation.holds_own_stock? |
|
|
|
[ |
|
|
|
[ |
|
|
@ -25,6 +24,7 @@ module NavigationItemsHelper |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", sales_logs_path, sales_logs_current?(path)) : nil, |
|
|
|
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("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("About your organisation", "/organisations/#{current_user.organisation.id}", subnav_details_path?(path)), |
|
|
|
|
|
|
|
NavigationItem.new("Housing providers", "/housing-providers", subnav_housing_providers_path?(path)), |
|
|
|
].compact |
|
|
|
].compact |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -32,18 +32,19 @@ module NavigationItemsHelper |
|
|
|
def secondary_items(path, current_organisation_id) |
|
|
|
def secondary_items(path, current_organisation_id) |
|
|
|
if current_user.organisation.holds_own_stock? |
|
|
|
if current_user.organisation.holds_own_stock? |
|
|
|
[ |
|
|
|
[ |
|
|
|
NavigationItem.new("Lettings logs", "/organisations/#{current_organisation_id}/lettings-logs", subnav_logs_path?(path)), |
|
|
|
NavigationItem.new("Lettings logs", "/organisations/#{current_organisation_id}/lettings-logs", subnav_lettings_logs_path?(path)), |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", "/organisations/#{current_organisation_id}/sales-logs", sales_logs_current?(path)) : nil, |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", "/organisations/#{current_organisation_id}/sales-logs", subnav_sales_logs_path?(path)) : nil, |
|
|
|
NavigationItem.new("Schemes", "/organisations/#{current_organisation_id}/schemes", subnav_supported_housing_schemes_path?(path)), |
|
|
|
NavigationItem.new("Schemes", "/organisations/#{current_organisation_id}/schemes", subnav_supported_housing_schemes_path?(path)), |
|
|
|
NavigationItem.new("Users", "/organisations/#{current_organisation_id}/users", subnav_users_path?(path)), |
|
|
|
NavigationItem.new("Users", "/organisations/#{current_organisation_id}/users", subnav_users_path?(path)), |
|
|
|
NavigationItem.new("About this organisation", "/organisations/#{current_organisation_id}", subnav_details_path?(path)), |
|
|
|
NavigationItem.new("About this organisation", "/organisations/#{current_organisation_id}", subnav_details_path?(path)), |
|
|
|
].compact |
|
|
|
].compact |
|
|
|
else |
|
|
|
else |
|
|
|
[ |
|
|
|
[ |
|
|
|
NavigationItem.new("Lettings logs", "/organisations/#{current_organisation_id}/lettings-logs", subnav_logs_path?(path)), |
|
|
|
NavigationItem.new("Lettings logs", "/organisations/#{current_organisation_id}/lettings-logs", subnav_lettings_logs_path?(path)), |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", "/organisations/#{current_organisation_id}/sales-logs", sales_logs_current?(path)) : nil, |
|
|
|
FeatureToggle.sales_log_enabled? ? NavigationItem.new("Sales logs", "/organisations/#{current_organisation_id}/sales-logs", subnav_sales_logs_path?(path)) : nil, |
|
|
|
NavigationItem.new("Users", "/organisations/#{current_organisation_id}/users", subnav_users_path?(path)), |
|
|
|
NavigationItem.new("Users", "/organisations/#{current_organisation_id}/users", subnav_users_path?(path)), |
|
|
|
NavigationItem.new("About this organisation", "/organisations/#{current_organisation_id}", subnav_details_path?(path)), |
|
|
|
NavigationItem.new("About this organisation", "/organisations/#{current_organisation_id}", subnav_details_path?(path)), |
|
|
|
|
|
|
|
NavigationItem.new("Housing providers", "/organisations/#{current_organisation_id}/housing-providers", subnav_housing_providers_path?(path)), |
|
|
|
].compact |
|
|
|
].compact |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -76,8 +77,8 @@ private |
|
|
|
def organisations_current?(path) |
|
|
|
def organisations_current?(path) |
|
|
|
path == "/organisations" || path.include?("/organisations/") |
|
|
|
path == "/organisations" || path.include?("/organisations/") |
|
|
|
end |
|
|
|
end |
|
|
|
def housing_providers_current?(path) |
|
|
|
def subnav_housing_providers_path?(path) |
|
|
|
path == "/housing-providers" |
|
|
|
path.include?("/organisations") && path.include?("/housing-providers") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def subnav_supported_housing_schemes_path?(path) |
|
|
|
def subnav_supported_housing_schemes_path?(path) |
|
|
@ -88,10 +89,14 @@ private |
|
|
|
(path.include?("/organisations") && path.include?("/users")) || path.include?("/users/") |
|
|
|
(path.include?("/organisations") && path.include?("/users")) || path.include?("/users/") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def subnav_logs_path?(path) |
|
|
|
def subnav_lettings_logs_path?(path) |
|
|
|
path.include?("/organisations") && path.include?("/lettings-logs") |
|
|
|
path.include?("/organisations") && path.include?("/lettings-logs") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def subnav_sales_logs_path?(path) |
|
|
|
|
|
|
|
path.include?("/organisations") && path.include?("/sales-logs") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def subnav_details_path?(path) |
|
|
|
def subnav_details_path?(path) |
|
|
|
path.include?("/organisations") && path.include?("/details") |
|
|
|
path.include?("/organisations") && path.include?("/details") |
|
|
|
end |
|
|
|
end |
|
|
|