Browse Source

Cldc 1283 page headings and titles (#639)

* correct headings

* fixed titles

* fixed missing bracket and test

* removed test since we dont have hidden headers for non support users

* removed test since we dont have hidden headers for non support users

* correct title when no logs for support usert

* correct title for non support

* correct title for non support viewing logs

* correct title for non support viewing logs

* correct title for non support viewing logs - 3

* correct title for logs

* correct title for logs - 2

* fixed new title for no support tabs

* fixed new title for no support tabs - 2

* fixed rebasing
pull/644/head
J G 3 years ago committed by GitHub
parent
commit
03513b21ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      app/views/case_logs/index.html.erb
  2. 16
      app/views/layouts/organisations.html.erb
  3. 16
      app/views/organisations/index.html.erb
  4. 12
      app/views/organisations/logs.html.erb
  5. 14
      app/views/organisations/show.html.erb
  6. 12
      app/views/organisations/users.html.erb
  7. 13
      app/views/users/index.html.erb
  8. 14
      spec/requests/case_logs_controller_spec.rb
  9. 26
      spec/requests/organisations_controller_spec.rb

12
app/views/case_logs/index.html.erb

@ -1,16 +1,18 @@
<% item_label = @pagy.count > 1 ? "logs" : "log" %> <% item_label = @pagy.count > 1 ? "logs" : "log" %>
<% if @searched.present? %> <% 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 %> <% else %>
<% title = "Your organisation (Logs)" %> <% title = current_user.support? ? "Logs" : "#{current_user.organisation.name} (Logs)" %>
<% end %> <% end %>
<% content_for :title, title %> <% content_for :title, title %>
<% content_for :tab_title do %> <h1 class="govuk-heading-l">
<%= "Logs" %> <% unless current_user.support? %>
<span class="govuk-caption-l"><%= current_user.organisation.name %></span>
<% end %> <% end %>
Logs
</h1>
<div class="app-filter-layout" data-controller="filter-layout"> <div class="app-filter-layout" data-controller="filter-layout">
<div class="govuk-button-group app-filter-toggle"> <div class="govuk-button-group app-filter-toggle">

16
app/views/layouts/organisations.html.erb

@ -1,16 +0,0 @@
<% content_for :content do %>
<h1 class="govuk-heading-l">
<% if current_user.support? && request.path != "/organisations" %>
<span class="govuk-caption-l"><%= @organisation.name %></span>
<% end %>
<%= content_for(:title) %>
</h1>
<% items = tab_items(current_user) %>
<h2 class="govuk-visually-hidden"><%= content_for(:tab_title) %></h2>
<%= content_for?(:organisations_content) ? yield(:organisations_content) : yield %>
<% end %>
<%= render template: "layouts/application" %>

16
app/views/organisations/index.html.erb

@ -1,12 +1,26 @@
<% item_label = @pagy.count > 1 ? "organisations" : "organisation" %> <% item_label = @pagy.count > 1 ? "organisations" : "organisation" %>
<% if @searched.present? %> <% 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 %> <% else %>
<% title = "Organisations" %> <% title = "Organisations" %>
<% end %> <% end %>
<% content_for :title, title %> <% content_for :title, title %>
<h1 class="govuk-heading-l">
<% if current_user.support? && request.path == "/organisations" %>
Organisations
<% end %>
<% if current_user.support? && request.path != "/organisations" %>
<span class="govuk-caption-l"><%= @organisation.name %></span>
<h1 class="govuk-heading-l">Organisations</h1>
<% end %>
</h1>
<% items = tab_items(current_user) %>
<h2 class="govuk-visually-hidden">Organisations</h2>
<% if current_user.support? %> <% if current_user.support? %>
<%= govuk_button_link_to "Create a new organisation", new_organisation_path, html: { method: :get } %> <%= govuk_button_link_to "Create a new organisation", new_organisation_path, html: { method: :get } %>
<% end %> <% end %>

12
app/views/organisations/logs.html.erb

@ -1,15 +1,17 @@
<% item_label = @pagy.count > 1 ? "logs" : "log" %> <% item_label = @pagy.count > 1 ? "logs" : "log" %>
<% if @searched.present? %> <% 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 %> <% else %>
<% title = "Your organisation (Logs)" %> <% title = "#{@organisation.name} (Logs)" %>
<% end %> <% end %>
<% content_for :title, title %> <% content_for :title, title %>
<% content_for :tab_title do %> <h1 class="govuk-heading-l">
<%= "Logs" %> <h1 class="govuk-heading-l"><%= @organisation.name %></h1>
<% end %> </h1>
<h2 class="govuk-visually-hidden">Logs</h2>
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id), items: secondary_items(request.path, @organisation.id),

14
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 %> <h1 class="govuk-heading-l">
<%= "Details" %> <% if !current_user.support? %>
<span class="govuk-caption-l"><%= current_user.organisation.name %></span>
About your organisation
<% else %>
<h1 class="govuk-heading-l"><%= @organisation.name %></h1>
<% end %> <% end %>
</h1>
<h2 class="govuk-visually-hidden">About this organisation</h2>
<% if current_user.support? %> <% if current_user.support? %>
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(

12
app/views/organisations/users.html.erb

@ -1,15 +1,19 @@
<% item_label = @pagy.count > 1 ? "users" : "user" %> <% item_label = @pagy.count > 1 ? "users" : "user" %>
<% if @searched.present? %> <% 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 %> <% else %>
<% title = "Your organisation (User)" %> <% title = "#{@organisation.name} (Users)" %>
<% end %> <% end %>
<% content_for :title, title %> <% content_for :title, title %>
<% content_for :tab_title do %> <h1 class="govuk-heading-l">
<%= "Users" %> <% if current_user.support? %>
<h1 class="govuk-heading-l"><%= @organisation.name %></h1>
<% end %> <% end %>
</h1>
<h2 class="govuk-visually-hidden">Users</h2>
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id), items: secondary_items(request.path, @organisation.id),

13
app/views/users/index.html.erb

@ -1,15 +1,20 @@
<% item_label = @pagy.count > 1 ? "users" : "user" %> <% item_label = @pagy.count > 1 ? "users" : "user" %>
<% if @searched.present? %> <% 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 %> <% else %>
<% title = "Your organisation (Users)" %> <% title = current_user.support? ? "Users" : "#{current_user.organisation.name} (Users)" %>
<% end %> <% end %>
<% content_for :title, title %> <% content_for :title, title %>
<% content_for :tab_title do %> <h1 class="govuk-heading-l">
<%= "Users" %> <% unless current_user.support? %>
<span class="govuk-caption-l"><%= current_user.organisation.name %></span>
<% end %> <% end %>
Users
</h1>
<h2 class="govuk-visually-hidden">Users</h2>
<% if current_user.data_coordinator? || current_user.support? %> <% if current_user.data_coordinator? || current_user.support? %>
<%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %> <%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %>

14
spec/requests/case_logs_controller_spec.rb

@ -191,7 +191,7 @@ RSpec.describe CaseLogsController, type: :request do
it "page has correct title" do it "page has correct title" do
get "/logs", headers: headers, params: {} 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
end end
@ -326,7 +326,7 @@ RSpec.describe CaseLogsController, type: :request do
it "has search results in the title" do it "has search results in the title" do
get "/logs?search=#{log_to_search.id}", headers: headers, params: {} 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 end
it "shows case logs matching the id" do 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 it "has title with pagination details for page 1" do
get "/logs?search=#{logs[0].postcode_full}", headers: headers, params: {} 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 end
it "has title with pagination details for page 2" do it "has title with pagination details for page 2" do
get "/logs?search=#{logs[0].postcode_full}&page=2", headers: headers, params: {} 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
end end
@ -466,7 +466,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
it "does not have pagination in the title" do 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 end
it "shows the download csv link" do it "shows the download csv link" do
@ -542,7 +542,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
it "has pagination in the title" do 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
end end
@ -567,7 +567,7 @@ RSpec.describe CaseLogsController, type: :request do
end end
it "has pagination in the title" do 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 end
end end

26
spec/requests/organisations_controller_spec.rb

@ -84,11 +84,6 @@ RSpec.describe OrganisationsController, type: :request do
expect(response.body).to include(organisation.name) expect(response.body).to include(organisation.name)
end end
it "has a hidden header title" do
expected_html = "<h2 class=\"govuk-visually-hidden\"> Details"
expect(response.body).to include(expected_html)
end
it "has a change details link" do it "has a change details link" do
expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\"" expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
@ -323,11 +318,6 @@ RSpec.describe OrganisationsController, type: :request do
expect(response.body).to include(organisation.name) expect(response.body).to include(organisation.name)
end end
it "has a hidden header title" do
expected_html = "<h2 class=\"govuk-visually-hidden\"> Details"
expect(response.body).to include(expected_html)
end
it "does not have a change details link" do it "does not have a change details link" do
expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\"" expected_html = "data-qa=\"change-name\" href=\"/organisations/#{organisation.id}/edit\""
expect(response.body).not_to include(expected_html) 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 it "has search results in the title" do
get "/organisations/#{organisation.id}/logs?search=#{log_to_search.id}", headers: headers, params: {} 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 end
it "shows case logs matching the id" do 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 it "has title with pagination details for page 1" do
get "/organisations/#{organisation.id}/logs?search=#{logs[0].postcode_full}", headers: headers, params: {} 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 end
it "has title with pagination details for page 2" do 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: {} 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
end end
@ -808,11 +798,11 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "updates the table caption" do 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 end
it "has search in the title" do 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 end
context "when the search term matches more than 1 result" do context "when the search term matches more than 1 result" do
@ -824,11 +814,11 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "updates the table caption" do 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 end
it "has search in the title" do 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
end end
@ -836,7 +826,7 @@ RSpec.describe OrganisationsController, type: :request do
let(:search_param) { "DLUHC" } let(:search_param) { "DLUHC" }
it "has search and pagination in the title" do 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 end
end end

Loading…
Cancel
Save