Browse Source

Design review (#789)

pull/790/head
Paul Robert Lloyd 2 years ago committed by GitHub
parent
commit
34a49c8288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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. 9
      app/views/organisations/schemes.html.erb
  5. 3
      app/views/organisations/show.html.erb
  6. 11
      app/views/organisations/users.html.erb
  7. 130
      app/views/schemes/check_answers.html.erb
  8. 2
      app/views/schemes/index.html.erb
  9. 20
      app/views/schemes/show.html.erb
  10. 4
      app/views/users/index.html.erb
  11. 2
      config/locales/en.yml
  12. 5
      spec/requests/organisations_controller_spec.rb
  13. 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")) %> <%= 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) %> <%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %>
<%= govuk_section_break(visible: true, size: "m") %> <%= 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" } %> <%= 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? %> <% 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 %>

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

@ -5,11 +5,12 @@
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %> <%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
<%= render SubNavigationComponent.new( <% if current_user.support? %>
items: secondary_items(request.path, @organisation.id), <%= render SubNavigationComponent.new(
) %> items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Logs</h2> <h2 class="govuk-visually-hidden">Logs</h2>
<% end %>
<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">

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

@ -3,17 +3,22 @@
<% content_for :title, title %> <% content_for :title, title %>
<%= render partial: "organisations/headings", locals: current_user.support? ? { main: @organisation.name, sub: nil } : { main: "Schemes", sub: current_user.organisation.name } %> <%= render partial: "organisations/headings", locals: current_user.support? ? { main: @organisation.name, sub: nil } : { main: "Supported housing schemes", sub: current_user.organisation.name } %>
<% if current_user.support? %> <% if current_user.support? %>
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id), items: secondary_items(request.path, @organisation.id),
) %> ) %>
<h2 class="govuk-visually-hidden">Supported housing schemes</h2>
<% end %> <% end %>
<%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> <%= 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?",
text: "A supported housing scheme (also known as a ‘supported housing service’) provides shared or self-contained housing for a particular client group, for example younger or vulnerable people. A single scheme can contain multiple units, for example bedrooms in shared houses or a bungalow with 3 bedrooms.",
) %>
<%= render SearchComponent.new(current_user:, search_label: "Search by scheme name, code or postcode", value: @searched) %> <%= render SearchComponent.new(current_user:, search_label: "Search by scheme name, code or postcode", value: @searched) %>

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

@ -8,10 +8,9 @@
<%= render SubNavigationComponent.new( <%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id), items: secondary_items(request.path, @organisation.id),
) %> ) %>
<h2 class="govuk-visually-hidden">About this organisation</h2>
<% end %> <% end %>
<h2 class="govuk-visually-hidden">About this organisation</h2>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<%= govuk_summary_list do |summary_list| %> <%= 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 partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
<%= render SubNavigationComponent.new( <% if current_user.support? %>
items: secondary_items(request.path, @organisation.id), <%= render SubNavigationComponent.new(
) %> items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Users</h2> <h2 class="govuk-visually-hidden">Users</h2>
<% end %>
<% 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(organisation_id: @organisation.id), html: { method: :get } %> <%= govuk_button_link_to "Invite user", new_user_path(organisation_id: @organisation.id), html: { method: :get } %>

130
app/views/schemes/check_answers.html.erb

@ -2,76 +2,76 @@
<%= render partial: "organisations/headings", locals: { main: "Check your changes before creating this scheme", sub: @scheme.service_name } %> <%= render partial: "organisations/headings", locals: { main: "Check your changes before creating this scheme", sub: @scheme.service_name } %>
<%= form_for(@scheme, as: :scheme, method: :patch) do |f| %> <%= form_for(@scheme, as: :scheme, method: :patch) do |f| %>
<div class="govuk-grid-row"> <%= f.govuk_error_summary %>
<%= f.govuk_error_summary %> <%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %>
<%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %> <% component.tab(label: "Scheme") do %>
<% component.tab(label: "Scheme") do %> <h2 class="govuk-visually-hidden">Scheme</h2>
<dl class="govuk-summary-list"> <dl class="govuk-summary-list">
<% @scheme.check_details_attributes.each do |attr| %> <% @scheme.check_details_attributes.each do |attr| %>
<% next if current_user.data_coordinator? && attr[:name] == ("owned by") %> <% next if current_user.data_coordinator? && attr[:name] == ("owned by") %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_details_path(@scheme, check_answers: true) } %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_details_path(@scheme, check_answers: true) } %>
<% end %>
<% if !@scheme.arrangement_type_same? %>
<% @scheme.check_support_services_provider_attributes.each do |attr| %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_support_services_provider_path(@scheme, check_answers: true) } %>
<% end %>
<% end %>
<% @scheme.check_primary_client_attributes.each do |attr| %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_primary_client_group_path(@scheme, check_answers: true) } %>
<% end %>
<% @scheme.check_secondary_client_confirmation_attributes.each do |attr| %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_confirm_secondary_client_group_path(@scheme, check_answers: true) } %>
<% end %>
<% if @scheme.has_other_client_group == "Yes" %>
<% @scheme.check_secondary_client_attributes.each do |attr| %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_secondary_client_group_path(@scheme, check_answers: true) } %>
<% end %>
<% end %>
<% @scheme.check_support_attributes.each do |attr| %>
<%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_support_path(@scheme, check_answers: true) } %>
<% end %>
</dl>
<% end %> <% end %>
<% component.tab(label: "Locations") do %> <% if !@scheme.arrangement_type_same? %>
<%= govuk_table do |table| %> <% @scheme.check_support_services_provider_attributes.each do |attr| %>
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_support_services_provider_path(@scheme, check_answers: true) } %>
<strong><%= @scheme.locations.count %></strong> <%= @scheme.locations.count.eql?(1) ? "location" : "locations" %> <% end %>
<% end %> <% end %>
<%= table.head do |head| %> <% @scheme.check_primary_client_attributes.each do |attr| %>
<%= head.row do |row| %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_primary_client_group_path(@scheme, check_answers: true) } %>
<% row.cell(header: true, text: "Code", html_attributes: { <% end %>
scope: "col", <% @scheme.check_secondary_client_confirmation_attributes.each do |attr| %>
}) %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_confirm_secondary_client_group_path(@scheme, check_answers: true) } %>
<% row.cell(header: true, text: "Postcode", html_attributes: { <% end %>
scope: "col", <% if @scheme.has_other_client_group == "Yes" %>
}) %> <% @scheme.check_secondary_client_attributes.each do |attr| %>
<% row.cell(header: true, text: "Units", html_attributes: { <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_secondary_client_group_path(@scheme, check_answers: true) } %>
scope: "col", <% end %>
}) %> <% end %>
<% row.cell(header: true, text: "Common unit type", html_attributes: { <% @scheme.check_support_attributes.each do |attr| %>
scope: "col", <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_support_path(@scheme, check_answers: true) } %>
}) %> <% end %>
<% row.cell(header: true, text: "Available from", html_attributes: { </dl>
scope: "col", <% end %>
}) %> <% component.tab(label: "Locations") do %>
<% end %> <h2 class="govuk-visually-hidden">Locations</h2>
<% end %> <%= govuk_table do |table| %>
<% @scheme.locations.each do |location| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
<%= table.body do |body| %> <strong><%= @scheme.locations.count %></strong> <%= @scheme.locations.count.eql?(1) ? "location" : "locations" %>
<%= body.row do |row| %> <% end %>
<% row.cell(text: location.id) %> <%= table.head do |head| %>
<% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <%= head.row do |row| %>
<% row.cell(text: location.units) %> <% row.cell(header: true, text: "Code", html_attributes: {
<% row.cell(text: simple_format("<span>#{location.type_of_unit}</span>")) %> scope: "col",
<% row.cell(text: location.startdate&.to_formatted_s(:govuk_date)) %> }) %>
<% end %> <% row.cell(header: true, text: "Postcode", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Units", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Common unit type", html_attributes: {
scope: "col",
}) %>
<% row.cell(header: true, text: "Available from", html_attributes: {
scope: "col",
}) %>
<% end %>
<% end %>
<% @scheme.locations.each do |location| %>
<%= table.body do |body| %>
<%= body.row do |row| %>
<% row.cell(text: location.id) %>
<% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
<% row.cell(text: location.units) %>
<% row.cell(text: simple_format("<span>#{location.type_of_unit}</span>")) %>
<% row.cell(text: location.startdate&.to_formatted_s(:govuk_date)) %>
<% end %> <% end %>
<% end %>
<% end %> <% end %>
<%= govuk_button_link_to "Add a location", new_location_path(id: @scheme.id), secondary: true %>
<% end %> <% end %>
<% end %> <% end %>
</div> <%= govuk_button_link_to "Add a location", new_location_path(id: @scheme.id), secondary: true %>
<% end %>
<% end %>
<%= f.hidden_field :page, value: "check-answers" %> <%= f.hidden_field :page, value: "check-answers" %>
<%= f.hidden_field :confirmed, value: "true" %> <%= f.hidden_field :confirmed, value: "true" %>
<% button_label = @scheme.confirmed? ? "Save" : "Create scheme" %> <% button_label = @scheme.confirmed? ? "Save" : "Create scheme" %>

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 } %> <%= 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 } %> <%= 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) %> <%= render SearchComponent.new(current_user:, search_label: "Search by scheme name, code or postcode", value: @searched) %>

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

@ -12,15 +12,15 @@
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %> <%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<div class="govuk-grid-row"> <h2 class="govuk-visually-hidden">Scheme</h2>
<%= govuk_summary_list do |summary_list| %>
<% @scheme.display_attributes.each do |attr| %> <%= govuk_summary_list do |summary_list| %>
<% next if current_user.data_coordinator? && attr[:name] == ("Housing stock owned by") %> <% @scheme.display_attributes.each do |attr| %>
<%= summary_list.row do |row| %> <% next if current_user.data_coordinator? && attr[:name] == ("Housing stock owned by") %>
<% row.key { attr[:name].eql?("Registered under Care Standards Act 2000") ? "Registered under Care Standards Act 2000" : attr[:name].to_s.humanize } %> <%= summary_list.row do |row| %>
<% row.value { details_html(attr) } %> <% row.key { attr[:name].eql?("Registered under Care Standards Act 2000") ? "Registered under Care Standards Act 2000" : attr[:name].to_s.humanize } %>
<% row.action(text: "Change", href: scheme_edit_name_path(scheme_id: @scheme.id)) if attr[:edit] %> <% row.value { details_html(attr) } %>
<% end %> <% row.action(text: "Change", href: scheme_edit_name_path(scheme_id: @scheme.id)) if attr[:edit] %>
<% end %> <% end %>
<% end %> <% end %>
</div> <% end %>

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

@ -3,9 +3,7 @@
<% content_for :title, title %> <% content_for :title, title %>
<%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Users", sub: nil } : { main: "User", sub: current_user.organisation.name } %> <%= render partial: "organisations/headings", locals: current_user.support? ? { main: "Users", sub: nil } : { main: "Users", sub: current_user.organisation.name } %>
<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 } %>

2
config/locales/en.yml

@ -325,7 +325,7 @@ en:
name: "Location name (optional)" name: "Location name (optional)"
units: "Total number of units at this location" units: "Total number of units at this location"
type_of_unit: "What is the most common type of unit at this location?" type_of_unit: "What is the most common type of unit at this location?"
startdate: "When did the first property in this location become available under this scheme?" startdate: "When did the first property in this location become available under this scheme? (optional)"
add_another_location: "Do you want to add another location?" add_another_location: "Do you want to add another location?"
mobility_type: "What are the mobility standards for the majority of units in this location?" mobility_type: "What are the mobility standards for the majority of units in this location?"
descriptions: descriptions:

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") expect(page).to have_field("search", type: "search")
end 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 it "shows only schemes belonging to the same organisation" do
expect(page).to have_content(same_org_scheme.id_to_display) expect(page).to have_content(same_org_scheme.id_to_display)
schemes.each do |scheme| 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.") expect(CGI.unescape_html(response.body)).to match("<strong>#{schemes.count}</strong> total schemes.")
end 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 context "when params scheme_id is present" do
it "shows a success banner" do it "shows a success banner" do
get "/schemes", params: { scheme_id: schemes.first.id } get "/schemes", params: { scheme_id: schemes.first.id }

Loading…
Cancel
Save