Browse Source

Update your organisation header and nav item (#2140)

pull/2143/head
kosiakkatrina 12 months ago committed by GitHub
parent
commit
95b06b94da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/helpers/navigation_items_helper.rb
  2. 4
      app/views/organisations/show.html.erb
  3. 8
      spec/features/organisation_spec.rb
  4. 6
      spec/features/user_spec.rb
  5. 22
      spec/helpers/navigation_items_helper_spec.rb

2
app/helpers/navigation_items_helper.rb

@ -16,7 +16,7 @@ module NavigationItemsHelper
NavigationItem.new("Sales logs", sales_logs_path, sales_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("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("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("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)), NavigationItem.new("Stock owners", stock_owners_organisation_path(current_user.organisation), stock_owners_path?(path)),
NavigationItem.new("Managing agents", managing_agents_organisation_path(current_user.organisation), managing_agents_path?(path)), NavigationItem.new("Managing agents", managing_agents_organisation_path(current_user.organisation), managing_agents_path?(path)),
].compact ].compact

4
app/views/organisations/show.html.erb

@ -1,8 +1,8 @@
<% title = current_user.support? ? "#{@organisation.name} (Organisation details)" : "Organisation details" %> <% title = current_user.support? ? "#{@organisation.name} (Organisation details)" : "Organisation details" %>
<% title = format_title(nil, current_user.support? ? "About this organisation" : "About your organisation", current_user, nil, nil, @organisation.name) %> <% title = format_title(nil, current_user.support? ? "About this organisation" : "Your organisation", current_user, nil, nil, @organisation.name) %>
<% content_for :title, title %> <% content_for :title, title %>
<%= render partial: "organisations/headings", locals: current_user.support? ? { main: @organisation.name, sub: nil } : { main: "About your organisation", sub: current_user.organisation.name } %> <%= render partial: "organisations/headings", locals: current_user.support? ? { main: @organisation.name, sub: nil } : { main: "Your organisation", sub: current_user.organisation.name } %>
<% if current_user.support? %> <% if current_user.support? %>
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(

8
spec/features/organisation_spec.rb

@ -28,7 +28,7 @@ RSpec.describe "User Features" do
context "when viewing organisation page" do context "when viewing organisation page" do
it "defaults to organisation details" do it "defaults to organisation details" do
visit("/lettings-logs") visit("/lettings-logs")
click_link("About your organisation") click_link("Your organisation")
expect(page).to have_content(user.organisation.name) expect(page).to have_content(user.organisation.name)
end end
@ -36,7 +36,7 @@ RSpec.describe "User Features" do
visit("/organisations/#{org_id}") visit("/organisations/#{org_id}")
click_link("Users") click_link("Users")
expect(page).to have_current_path("/organisations/#{org_id}/users") expect(page).to have_current_path("/organisations/#{org_id}/users")
click_link("About your organisation") click_link("Your organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details") expect(page).to have_current_path("/organisations/#{org_id}/details")
end end
@ -99,11 +99,11 @@ RSpec.describe "User Features" do
context "when viewing organisation page" do context "when viewing organisation page" do
it "can see the details tab and users tab" do it "can see the details tab and users tab" do
visit("/lettings-logs") visit("/lettings-logs")
click_link("About your organisation") click_link("Your organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details") expect(page).to have_current_path("/organisations/#{org_id}/details")
expect(page).to have_link("Lettings logs") expect(page).to have_link("Lettings logs")
expect(page).to have_link("Users") expect(page).to have_link("Users")
expect(page).to have_link("About your organisation") expect(page).to have_link("Your organisation")
end end
end end
end end

6
spec/features/user_spec.rb

@ -244,7 +244,7 @@ RSpec.describe "User Features" do
it "highlights the users navigation tab" do it "highlights the users navigation tab" do
expect(page).to have_css('[aria-current="page"]', text: "Users") expect(page).to have_css('[aria-current="page"]', text: "Users")
expect(page).not_to have_css('[aria-current="page"]', text: "About your organisation") expect(page).not_to have_css('[aria-current="page"]', text: "Your organisation")
expect(page).not_to have_css('[aria-current="page"]', text: "Logs") expect(page).not_to have_css('[aria-current="page"]', text: "Logs")
end end
@ -288,11 +288,11 @@ RSpec.describe "User Features" do
fill_in("user[email]", with: user.email) fill_in("user[email]", with: user.email)
fill_in("user[password]", with: "pAssword1") fill_in("user[password]", with: "pAssword1")
click_button("Sign in") click_button("Sign in")
click_link("About your organisation") click_link("Your organisation")
end end
it "highlights the users navigation tab" do it "highlights the users navigation tab" do
expect(page).to have_css('[aria-current="page"]', text: "About your organisation") expect(page).to have_css('[aria-current="page"]', text: "Your organisation")
expect(page).not_to have_css('[aria-current="page"]', text: "Users") expect(page).not_to have_css('[aria-current="page"]', text: "Users")
expect(page).not_to have_css('[aria-current="page"]', text: "Logs") expect(page).not_to have_css('[aria-current="page"]', text: "Logs")
end end

22
spec/helpers/navigation_items_helper_spec.rb

@ -15,7 +15,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Lettings logs", "/lettings-logs", true), NavigationItemsHelper::NavigationItem.new("Lettings logs", "/lettings-logs", true),
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -38,7 +38,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -57,7 +57,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -75,7 +75,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", true), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", true),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -93,7 +93,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -111,7 +111,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", true), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", true),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -129,7 +129,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -147,7 +147,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -165,7 +165,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", true), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", true),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -194,7 +194,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Lettings logs", "/lettings-logs", true), NavigationItemsHelper::NavigationItem.new("Lettings logs", "/lettings-logs", true),
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]
@ -217,7 +217,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false), NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false), NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false), NavigationItemsHelper::NavigationItem.new("Your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false), NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false), NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
] ]

Loading…
Cancel
Save