diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb index b18e22861..0580e18a9 100644 --- a/app/views/case_logs/index.html.erb +++ b/app/views/case_logs/index.html.erb @@ -1,16 +1,18 @@ <% item_label = @pagy.count > 1 ? "logs" : "log" %> - <% if @searched.present? %> - <% title = "Your organisation (#{@pagy.count} #{item_label} matching ‘#{@searched}’ of #{@total_count} total logs)" %> + <% title = "#{current_user.support? ? 'Logs' : current_user.organisation.name} (#{@pagy.count} #{item_label} matching ‘#{@searched}’)" %> <% else %> - <% title = "Your organisation (Logs)" %> + <% title = current_user.support? ? "Logs" : "#{current_user.organisation.name} (Logs)" %> <% end %> <% content_for :title, title %> -<% content_for :tab_title do %> - <%= "Logs" %> -<% end %> +

+ <% unless current_user.support? %> + <%= current_user.organisation.name %> + <% end %> + Logs +

diff --git a/app/views/layouts/organisations.html.erb b/app/views/layouts/organisations.html.erb deleted file mode 100644 index cb4d1c716..000000000 --- a/app/views/layouts/organisations.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -<% content_for :content do %> -

- <% if current_user.support? && request.path != "/organisations" %> - <%= @organisation.name %> - <% end %> - <%= content_for(:title) %> -

- - <% items = tab_items(current_user) %> - -

<%= content_for(:tab_title) %>

- - <%= content_for?(:organisations_content) ? yield(:organisations_content) : yield %> -<% end %> - -<%= render template: "layouts/application" %> diff --git a/app/views/organisations/index.html.erb b/app/views/organisations/index.html.erb index 15456642a..c0587ab51 100644 --- a/app/views/organisations/index.html.erb +++ b/app/views/organisations/index.html.erb @@ -1,12 +1,26 @@ <% item_label = @pagy.count > 1 ? "organisations" : "organisation" %> <% if @searched.present? %> - <% title = "Organisations (#{@pagy.count} #{item_label} matching ‘#{@searched}’ of #{@total_count} total organisations)" %> + <% title = "Organisations (#{@pagy.count} #{item_label} matching ‘#{@searched}’)" %> <% else %> <% title = "Organisations" %> <% end %> <% content_for :title, title %> +

+ <% if current_user.support? && request.path == "/organisations" %> + Organisations + <% end %> + <% if current_user.support? && request.path != "/organisations" %> + <%= @organisation.name %> +

Organisations

+ <% end %> + + +<% items = tab_items(current_user) %> + +

Organisations

+ <% if current_user.support? %> <%= govuk_button_link_to "Create a new organisation", new_organisation_path, html: { method: :get } %> <% end %> diff --git a/app/views/organisations/logs.html.erb b/app/views/organisations/logs.html.erb index a5e62dbf8..074fe3296 100644 --- a/app/views/organisations/logs.html.erb +++ b/app/views/organisations/logs.html.erb @@ -1,15 +1,17 @@ <% item_label = @pagy.count > 1 ? "logs" : "log" %> <% if @searched.present? %> - <% title = "Your organisation (#{@pagy.count} #{item_label} matching ‘#{@searched}’ of #{@total_count} total logs)" %> + <% title = "#{@organisation.name} (#{@pagy.count} #{item_label} matching ‘#{@searched}’)" %> <% else %> - <% title = "Your organisation (Logs)" %> + <% title = "#{@organisation.name} (Logs)" %> <% end %> <% content_for :title, title %> -<% content_for :tab_title do %> - <%= "Logs" %> -<% end %> +

+

<%= @organisation.name %>

+ + +

Logs

<%= render SubNavigationComponent.new( items: secondary_items(request.path, @organisation.id), diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index f4760a7c9..93f6ca76a 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -1,8 +1,16 @@ -<% content_for :title, current_user.support? ? "Details" : "Your organisation" %> +<% title = "#{@organisation.name} (Organisation details)" %> +<% content_for :title, title %> -<% content_for :tab_title do %> - <%= "Details" %> -<% end %> +

+ <% if !current_user.support? %> + <%= current_user.organisation.name %> + About your organisation + <% else %> +

<%= @organisation.name %>

+ <% end %> + + +

About this organisation

<% if current_user.support? %> <%= render SubNavigationComponent.new( diff --git a/app/views/organisations/users.html.erb b/app/views/organisations/users.html.erb index 67df43109..6d846c29c 100644 --- a/app/views/organisations/users.html.erb +++ b/app/views/organisations/users.html.erb @@ -1,15 +1,19 @@ <% item_label = @pagy.count > 1 ? "users" : "user" %> <% if @searched.present? %> - <% title = "Your organisation (#{@pagy.count} #{item_label} matching ‘#{@searched}’ of #{@total_count} total users)" %> + <% title = "#{@organisation.name} (#{@pagy.count} #{item_label} matching ‘#{@searched}’" %> <% else %> - <% title = "Your organisation (User)" %> + <% title = "#{@organisation.name} (Users)" %> <% end %> <% content_for :title, title %> -<% content_for :tab_title do %> - <%= "Users" %> -<% end %> +

+ <% if current_user.support? %> +

<%= @organisation.name %>

+ <% end %> + + +

Users

<%= render SubNavigationComponent.new( items: secondary_items(request.path, @organisation.id), diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 1569a8097..7bd9b9be5 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,15 +1,20 @@ <% item_label = @pagy.count > 1 ? "users" : "user" %> <% if @searched.present? %> - <% title = "Your organisation (#{@pagy.count} #{item_label} matching ‘#{@searched}’ of #{@total_count} total users)" %> + <% title = "#{current_user.support? ? 'Users' : current_user.organisation.name} (#{@pagy.count} #{item_label} matching ‘#{@searched}’" %> <% else %> - <% title = "Your organisation (Users)" %> + <% title = current_user.support? ? "Users" : "#{current_user.organisation.name} (Users)" %> <% end %> <% content_for :title, title %> -<% content_for :tab_title do %> - <%= "Users" %> -<% end %> +

+ <% unless current_user.support? %> + <%= current_user.organisation.name %> + <% end %> + Users +

+ +

Users

<% if current_user.data_coordinator? || current_user.support? %> <%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %> diff --git a/spec/requests/case_logs_controller_spec.rb b/spec/requests/case_logs_controller_spec.rb index ef78e0b5f..6c5a0185b 100644 --- a/spec/requests/case_logs_controller_spec.rb +++ b/spec/requests/case_logs_controller_spec.rb @@ -191,7 +191,7 @@ RSpec.describe CaseLogsController, type: :request do it "page has correct title" do get "/logs", headers: headers, params: {} - expect(page).to have_title("Your organisation (Logs) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("Logs - Submit social housing lettings and sales data (CORE) - GOV.UK") end end @@ -326,7 +326,7 @@ RSpec.describe CaseLogsController, type: :request do it "has search results in the title" do get "/logs?search=#{log_to_search.id}", headers: headers, params: {} - expect(page).to have_title("Your organisation (1 log matching ‘#{log_to_search.id}’ of #{log_total_count} total logs) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{log_to_search.owning_organisation.name} (1 log matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") end it "shows case logs matching the id" do @@ -381,12 +381,12 @@ RSpec.describe CaseLogsController, type: :request do it "has title with pagination details for page 1" do get "/logs?search=#{logs[0].postcode_full}", headers: headers, params: {} - expect(page).to have_title("Your organisation (#{logs.count} logs matching ‘#{postcode}’ of #{log_total_count} total logs) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{log_to_search.owning_organisation.name} (#{logs.count} logs matching ‘#{postcode}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end it "has title with pagination details for page 2" do get "/logs?search=#{logs[0].postcode_full}&page=2", headers: headers, params: {} - expect(page).to have_title("Your organisation (#{logs.count} logs matching ‘#{postcode}’ of #{log_total_count} total logs) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{log_to_search.owning_organisation.name} (#{logs.count} logs matching ‘#{postcode}’) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end end @@ -466,7 +466,7 @@ RSpec.describe CaseLogsController, type: :request do end it "does not have pagination in the title" do - expect(page).to have_title("Your organisation (Logs) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{user.organisation.name} (Logs) - Submit social housing lettings and sales data (CORE) - GOV.UK") end it "shows the download csv link" do @@ -542,7 +542,7 @@ RSpec.describe CaseLogsController, type: :request do end it "has pagination in the title" do - expect(page).to have_title("Your organisation (Logs) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{user.organisation.name} (Logs) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end end @@ -567,7 +567,7 @@ RSpec.describe CaseLogsController, type: :request do end it "has pagination in the title" do - expect(page).to have_title("Your organisation (Logs) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{user.organisation.name} (Logs) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end end end diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 74d7aba46..5c4cef674 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -84,11 +84,6 @@ RSpec.describe OrganisationsController, type: :request do expect(response.body).to include(organisation.name) end - it "has a hidden header title" do - expected_html = "

Details" - expect(response.body).to include(expected_html) - end - it "has a change details link" do expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\"" expect(response.body).to include(expected_html) @@ -323,11 +318,6 @@ RSpec.describe OrganisationsController, type: :request do expect(response.body).to include(organisation.name) end - it "has a hidden header title" do - expected_html = "

Details" - expect(response.body).to include(expected_html) - end - it "does not have a change details link" do expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\"" expect(response.body).not_to include(expected_html) @@ -491,7 +481,7 @@ RSpec.describe OrganisationsController, type: :request do it "has search results in the title" do get "/organisations/#{organisation.id}/logs?search=#{log_to_search.id}", headers: headers, params: {} - expect(page).to have_title("Your organisation (1 log matching ‘#{log_to_search.id}’ of #{log_total_count} total logs) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{organisation.name} (1 log matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") end it "shows case logs matching the id" do @@ -546,12 +536,12 @@ RSpec.describe OrganisationsController, type: :request do it "has title with pagination details for page 1" do get "/organisations/#{organisation.id}/logs?search=#{logs[0].postcode_full}", headers: headers, params: {} - expect(page).to have_title("Your organisation (#{logs.count} logs matching ‘#{postcode}’ of #{log_total_count} total logs) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{organisation.name} (#{logs.count} logs matching ‘#{postcode}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end it "has title with pagination details for page 2" do get "/organisations/#{organisation.id}/logs?search=#{logs[0].postcode_full}&page=2", headers: headers, params: {} - expect(page).to have_title("Your organisation (#{logs.count} logs matching ‘#{postcode}’ of #{log_total_count} total logs) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("#{organisation.name} (#{logs.count} logs matching ‘#{postcode}’) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end end @@ -808,11 +798,11 @@ RSpec.describe OrganisationsController, type: :request do end it "updates the table caption" do - expect(page).to have_content("1 organisation found matching ‘#{search_param}’ of 29 total organisations.") + expect(page).to have_content("1 organisation found matching ‘#{search_param}’") end it "has search in the title" do - expect(page).to have_title("Organisations (1 organisation matching ‘#{search_param}’ of 29 total organisations) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("Organisations (1 organisation matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") end context "when the search term matches more than 1 result" do @@ -824,11 +814,11 @@ RSpec.describe OrganisationsController, type: :request do end it "updates the table caption" do - expect(page).to have_content("2 organisations found matching ‘#{search_param}’ of 29 total organisations.") + expect(page).to have_content("2 organisations found matching ‘#{search_param}’") end it "has search in the title" do - expect(page).to have_title("Organisations (2 organisations matching ‘#{search_param}’ of 29 total organisations) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("Organisations (2 organisations matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") end end @@ -836,7 +826,7 @@ RSpec.describe OrganisationsController, type: :request do let(:search_param) { "DLUHC" } it "has search and pagination in the title" do - expect(page).to have_title("Organisations (27 organisations matching ‘#{search_param}’ of 29 total organisations) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") + expect(page).to have_title("Organisations (27 organisations matching ‘#{search_param}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK") end end end