- <% if flash.notice && !flash.notice.include?('translation missing') %> + <% if flash.notice && !flash.notice.include?("translation missing") %> <%= govuk_notification_banner( - title_text: 'Success', + title_text: "Success", success: true, title_heading_level: 3, - title_id: "swanky-notifications") do |notification_banner| - notification_banner.heading(text: flash.notice) + title_id: "swanky-notifications" + ) do |notification_banner| + notification_banner.heading(text: flash.notice) end %> <% end %> <%= content_for?(:content) ? yield(:content) : yield %> diff --git a/app/views/layouts/organisations.html.erb b/app/views/layouts/organisations.html.erb index b316bf64f..aea5983c3 100644 --- a/app/views/layouts/organisations.html.erb +++ b/app/views/layouts/organisations.html.erb @@ -5,7 +5,7 @@ <% items = tab_items(current_user) %> - <%= render TabNavigationComponent.new(items: items) %> + <%= render TabNavigationComponent.new(items:) %>

<%= content_for(:tab_title) %>

diff --git a/app/views/organisations/edit.html.erb b/app/views/organisations/edit.html.erb index b0c0d6adb..93dafc4a7 100644 --- a/app/views/organisations/edit.html.erb +++ b/app/views/organisations/edit.html.erb @@ -2,7 +2,7 @@ <% content_for :before_content do %> <%= govuk_back_link( - text: 'Back', + text: "Back", href: :back, ) %> <% end %> diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index 8af61268f..f98ea86a9 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -10,17 +10,21 @@ <% @organisation.display_attributes.each do |attr| %> <% if current_user.data_coordinator? && attr[:editable] %> - <%= summary_list.row do |row| - row.key { attr[:name].to_s.humanize } - row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } - row.action(visually_hidden_text: 'name', href: edit_organisation_path, html_attributes: { 'data-qa': "change-#{attr[:name]}" }) - end %> + <%= summary_list.row do |row| %> + <% row.key { attr[:name].to_s.humanize } %> + <% row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } %> + <% row.action( + visually_hidden_text: "name", + href: edit_organisation_path, + html_attributes: { "data-qa": "change-#{attr[:name]}" }, + ) %> + <% end %> <% else %> - <%= summary_list.row do |row| - row.key { attr[:name].to_s.humanize } - row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } - row.action() - end %> + <%= summary_list.row do |row| %> + <% row.key { attr[:name].to_s.humanize } %> + <% row.value { simple_format(attr[:value].to_s, {}, wrapper_tag: "div") } %> + <% row.action %> + <% end %> <% end %> <% end %> diff --git a/app/views/organisations/users.html.erb b/app/views/organisations/users.html.erb index 304528016..8c0e5e5d0 100644 --- a/app/views/organisations/users.html.erb +++ b/app/views/organisations/users.html.erb @@ -9,19 +9,19 @@ <% end %> <%= govuk_table do |table| %> <%= table.head do |head| %> - <%= head.row do |row| - row.cell(header: true, text: "Name and email adress") - row.cell(header: true, text: "Organisation and role") - row.cell(header: true, text: "Last logged in") - end %> + <%= head.row do |row| %> + <% row.cell(header: true, text: "Name and email adress") %> + <% row.cell(header: true, text: "Organisation and role") %> + <% row.cell(header: true, text: "Last logged in") %> + <% end %> <% end %> <% @organisation.users.each do |user| %> <%= table.body do |body| %> - <%= body.row do |row| - row.cell(text: simple_format(user_cell(user), {}, wrapper_tag: "div")) - row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) - row.cell(text: user.last_sign_in_at&.to_formatted_s(:govuk_date) ) - end %> + <%= body.row do |row| %> + <% row.cell(text: simple_format(user_cell(user), {}, wrapper_tag: "div")) %> + <% row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) %> + <% row.cell(text: user.last_sign_in_at&.to_formatted_s(:govuk_date)) %> + <% end %> <% end %> <% end %> <% end %> diff --git a/app/views/start/index.html.erb b/app/views/start/index.html.erb index 578fccc53..72a6619e4 100644 --- a/app/views/start/index.html.erb +++ b/app/views/start/index.html.erb @@ -10,10 +10,10 @@

The data will be used to update the national record for social housing. It will also help to inform policy about the cost of social housing and what type of housing needs to be built.

This service is only for social housing in England.

- <% start_path = current_user ? case_logs_path : (user_session_path + "?start=true") %> + <% start_path = current_user ? case_logs_path : "#{user_session_path}?start=true" %> <%= govuk_start_button( - text: 'Start now', - href: start_path + text: "Start now", + href: start_path, ) %>

Before you start

diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 257764f7f..d357f69fc 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -2,7 +2,7 @@ <% content_for :before_content do %> <%= govuk_back_link( - text: 'Back', + text: "Back", href: :back, ) %> <% end %> @@ -25,9 +25,13 @@ spellcheck: "false" %> <% if current_user.data_coordinator? || current_user.support? %> - <%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } + <%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> - f.govuk_collection_radio_buttons :role, roles, :id, :name, legend: { text: "Role", size: "m" } %> + <%= f.govuk_collection_radio_buttons :role, + roles, + :id, + :name, + legend: { text: "Role", size: "m" } %> <%= f.govuk_collection_radio_buttons :is_dpo, [OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 903af4d3b..488290ee2 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -2,7 +2,7 @@ <% content_for :before_content do %> <%= govuk_back_link( - text: 'Back', + text: "Back", href: :back, ) %> <% end %> @@ -25,8 +25,13 @@ spellcheck: "false", value: @resource.email %> - <%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } - f.govuk_collection_radio_buttons :role, roles, :id, :name, legend: { text: "Role", size: "m" } %> + <%= roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + + <%= f.govuk_collection_radio_buttons :role, + roles, + :id, + :name, + legend: { text: "Role", size: "m" } %> <%= f.govuk_collection_radio_buttons :is_dpo, [OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 846472ca1..af0aa0599 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -12,70 +12,86 @@ <%= govuk_summary_list do |summary_list| %> <%= summary_list.row do |row| - row.key { "Name" } - row.value { @user.name } - if can_edit_names?(@user, current_user) - row.action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" }) - else - row.action() - end - end %> + row.key { "Name" } + row.value { @user.name } + if can_edit_names?(@user, current_user) + row.action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" }) + else + row.action + end + end %> - <%= summary_list.row() do |row| - row.key { "Email address" } - row.value { @user.email } - if can_edit_emails?(@user, current_user) - row.action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" }) - else - row.action() - end - end %> + <%= summary_list.row do |row| + row.key { "Email address" } + row.value { @user.email } + if can_edit_emails?(@user, current_user) + row.action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" }) + else + row.action + end + end %> <%= summary_list.row do |row| - row.key { "Password" } - row.value { "••••••••" } - if can_edit_password?(@user, current_user) - row.action(visually_hidden_text: "password", href: edit_password_account_path, html_attributes: { "data-qa": "change-password" }) - else - row.action() - end - end %> + row.key { "Password" } + row.value { "••••••••" } + if can_edit_password?(@user, current_user) + row.action( + visually_hidden_text: "password", + href: edit_password_account_path, + html_attributes: { "data-qa": "change-password" }, + ) + else + row.action + end + end %> <%= summary_list.row do |row| - row.key { "Organisation" } - row.value { @user.organisation.name } - row.action() - end %> + row.key { "Organisation" } + row.value { @user.organisation.name } + row.action + end %> <%= summary_list.row do |row| - row.key { "Role" } - row.value { @user.role.humanize } - if can_edit_roles?(@user, current_user) - row.action(visually_hidden_text: "role", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-role" }) - else - row.action() - end - end %> + row.key { "Role" } + row.value { @user.role.humanize } + if can_edit_roles?(@user, current_user) + row.action( + visually_hidden_text: "role", + href: aliased_user_edit(@user, current_user), + html_attributes: { "data-qa": "change-role" }, + ) + else + row.action + end + end %> <%= summary_list.row do |row| - row.key { "Data protection officer" } - row.value { @user.is_data_protection_officer? ? "Yes" : "No" } - if can_edit_dpo?(@user, current_user) - row.action(visually_hidden_text: "are #{pronoun(@user, current_user)} a data protection officer?", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-data-protection-officer" }) - else - row.action() - end - end %> + row.key { "Data protection officer" } + row.value { @user.is_data_protection_officer? ? "Yes" : "No" } + if can_edit_dpo?(@user, current_user) + row.action( + visually_hidden_text: "are #{pronoun(@user, current_user)} a data protection officer?", + href: aliased_user_edit(@user, current_user), + html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-data-protection-officer" }, + ) + else + row.action + end + end %> <%= summary_list.row do |row| - row.key { "Key contact" } - row.value { @user.is_key_contact? ? "Yes" : "No" } - if can_edit_key_contact?(@user, current_user) - row.action(visually_hidden_text: "are #{pronoun(@user, current_user)} a key contact?", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-key-contact" }) - else - row.action() - end - end %> + row.key { "Key contact" } + row.value { @user.is_key_contact? ? "Yes" : "No" } + if can_edit_key_contact?(@user, current_user) + row.action( + visually_hidden_text: "are #{pronoun(@user, current_user)} a key contact?", + href: aliased_user_edit(@user, current_user), + html_attributes: { "data-qa": "change-are-#{pronoun(@user, current_user)}-a-key-contact" }, + ) + else + row.action + end + end %> <% end %>