Browse Source

Only show visually hidden heading for sections below sub navigation

pull/789/head
Paul Robert Lloyd 3 years ago
parent
commit
c626b845ae
  1. 2
      app/views/locations/index.html.erb
  2. 2
      app/views/organisations/index.html.erb
  3. 11
      app/views/organisations/logs.html.erb
  4. 3
      app/views/organisations/schemes.html.erb
  5. 3
      app/views/organisations/show.html.erb
  6. 11
      app/views/organisations/users.html.erb
  7. 2
      app/views/schemes/index.html.erb
  8. 2
      app/views/schemes/show.html.erb
  9. 2
      app/views/users/index.html.erb
  10. 5
      spec/requests/organisations_controller_spec.rb
  11. 5
      spec/requests/schemes_controller_spec.rb

2
app/views/locations/index.html.erb

@ -13,6 +13,8 @@
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<h2 class="govuk-visually-hidden">Locations</h2>
<%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %>
<%= govuk_section_break(visible: true, size: "m") %>

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

@ -5,8 +5,6 @@
<%= render partial: "organisations/headings", locals: request.path == "/organisations" ? { main: "Organisations", sub: nil } : { main: @organisation.name, sub: "Organisations" } %>
<h2 class="govuk-visually-hidden">Organisations</h2>
<% if current_user.support? %>
<%= govuk_button_link_to "Create a new organisation", new_organisation_path, html: { method: :get } %>
<% end %>

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

@ -5,11 +5,12 @@
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Logs</h2>
<% if current_user.support? %>
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Logs</h2>
<% end %>
<div class="app-filter-layout" data-controller="filter-layout">
<div class="govuk-button-group app-filter-toggle">

3
app/views/organisations/schemes.html.erb

@ -9,12 +9,11 @@
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Supported housing schemes</h2>
<% end %>
<%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %>
<h2 class="govuk-visually-hidden">Supported housing schemes</h2>
<%= govuk_details(
classes: "govuk-!-width-two-thirds",
summary_text: "What is a supported housing scheme?",

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

@ -8,10 +8,9 @@
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">About this organisation</h2>
<% end %>
<h2 class="govuk-visually-hidden">About this organisation</h2>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<%= govuk_summary_list do |summary_list| %>

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

@ -5,11 +5,12 @@
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Users</h2>
<% if current_user.support? %>
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Users</h2>
<% end %>
<% if current_user.data_coordinator? || current_user.support? %>
<%= govuk_button_link_to "Invite user", new_user_path(organisation_id: @organisation.id), html: { method: :get } %>

2
app/views/schemes/index.html.erb

@ -5,8 +5,6 @@
<%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Supported housing schemes", sub: nil } : { main: "Supported housing schemes", sub: current_user.organisation.name } %>
<h2 class="govuk-visually-hidden">Supported housing schemes</h2>
<%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %>
<%= render SearchComponent.new(current_user:, search_label: "Search by scheme name, code or postcode", value: @searched) %>

2
app/views/schemes/show.html.erb

@ -12,6 +12,8 @@
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<h2 class="govuk-visually-hidden">Scheme</h2>
<div class="govuk-grid-row">
<%= govuk_summary_list do |summary_list| %>
<% @scheme.display_attributes.each do |attr| %>

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

@ -5,8 +5,6 @@
<%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Users", sub: nil } : { main: "User", sub: current_user.organisation.name } %>
<h2 class="govuk-visually-hidden">Users</h2>
<% if current_user.data_coordinator? || current_user.support? %>
<%= govuk_button_link_to "Invite user", new_user_path, html: { method: :get } %>
<% end %>

5
spec/requests/organisations_controller_spec.rb

@ -116,11 +116,6 @@ RSpec.describe OrganisationsController, type: :request do
expect(page).to have_field("search", type: "search")
end
it "has hidden accessibility field with description" do
expected_field = "<h2 class=\"govuk-visually-hidden\">Supported housing schemes</h2>"
expect(CGI.unescape_html(response.body)).to include(expected_field)
end
it "shows only schemes belonging to the same organisation" do
expect(page).to have_content(same_org_scheme.id_to_display)
schemes.each do |scheme|

5
spec/requests/schemes_controller_spec.rb

@ -93,11 +93,6 @@ RSpec.describe SchemesController, type: :request do
expect(CGI.unescape_html(response.body)).to match("<strong>#{schemes.count}</strong> total schemes.")
end
it "has hidden accebility field with description" do
expected_field = "<h2 class=\"govuk-visually-hidden\">Supported housing schemes</h2>"
expect(CGI.unescape_html(response.body)).to include(expected_field)
end
context "when params scheme_id is present" do
it "shows a success banner" do
get "/schemes", params: { scheme_id: schemes.first.id }

Loading…
Cancel
Save