Browse Source

Update govuk summary

update-version-test
Kat 1 year ago
parent
commit
1f641fda41
  1. 8
      app/components/check_answers_summary_list_card_component.html.erb
  2. 6
      app/helpers/data_sharing_agreement_helper.rb
  3. 10
      app/helpers/organisations_helper.rb
  4. 10
      app/views/duplicate_logs/_duplicate_log_check_answers.erb
  5. 8
      app/views/form/_check_answers_summary_list.html.erb
  6. 10
      app/views/locations/check_answers.html.erb
  7. 20
      app/views/locations/show.html.erb
  8. 16
      app/views/organisations/show.html.erb
  9. 78
      app/views/users/show.html.erb

8
app/components/check_answers_summary_list_card_component.html.erb

@ -9,9 +9,9 @@
<div class="govuk-summary-card__content"> <div class="govuk-summary-card__content">
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% applicable_questions.each do |question| %> <% applicable_questions.each do |question| %>
<% summary_list.row do |row| %> <% summary_list.with_row do |row| %>
<% row.key { get_question_label(question) } %> <% row.with_key { get_question_label(question) } %>
<% row.value do %> <% row.with_value do %>
<%= simple_format( <%= simple_format(
get_answer_label(question), get_answer_label(question),
wrapper_tag: "span", wrapper_tag: "span",
@ -34,7 +34,7 @@
<% end %> <% end %>
<% if @log.collection_period_open_for_editing? %> <% if @log.collection_period_open_for_editing? %>
<% row.action( <% row.with_action(
text: question.action_text(log), text: question.action_text(log),
href: action_href(log, question.page.id), href: action_href(log, question.page.id),
visually_hidden_text: question.check_answer_label.to_s.downcase, visually_hidden_text: question.check_answer_label.to_s.downcase,

6
app/helpers/data_sharing_agreement_helper.rb

@ -1,8 +1,8 @@
module DataSharingAgreementHelper module DataSharingAgreementHelper
def data_sharing_agreement_row(user:, organisation:, summary_list:) def data_sharing_agreement_row(user:, organisation:, summary_list:)
summary_list.row do |row| summary_list.with_row do |row|
row.key { "Data Sharing Agreement" } row.with_key { "Data Sharing Agreement" }
row.action( row.with_action(
href: data_sharing_agreement_organisation_path(organisation), href: data_sharing_agreement_organisation_path(organisation),
text: "View agreement", text: "View agreement",
) )

10
app/helpers/organisations_helper.rb

@ -23,17 +23,17 @@ module OrganisationsHelper
end end
def organisation_name_row(user:, organisation:, summary_list:) def organisation_name_row(user:, organisation:, summary_list:)
summary_list.row do |row| summary_list.with_row do |row|
row.key { "Name" } row.with_key { "Name" }
row.value { organisation.name } row.with_value { organisation.name }
if user.support? if user.support?
row.action( row.with_action(
visually_hidden_text: organisation.name.humanize.downcase, visually_hidden_text: organisation.name.humanize.downcase,
href: edit_organisation_path(organisation), href: edit_organisation_path(organisation),
html_attributes: { "data-qa": "change-#{organisation.name.downcase}" }, html_attributes: { "data-qa": "change-#{organisation.name.downcase}" },
) )
else else
row.action row.with_action
end end
end end
end end

10
app/views/duplicate_logs/_duplicate_log_check_answers.erb

@ -2,10 +2,10 @@
<div class="x-govuk-summary-card__body"> <div class="x-govuk-summary-card__body">
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% log.duplicate_check_questions(current_user).each do |question| %> <% log.duplicate_check_questions(current_user).each do |question| %>
<% summary_list.row do |row| %> <% summary_list.with_row do |row| %>
<% row.key { duplicate_log_question_label(question) } %> <% row.with_key { duplicate_log_question_label(question) } %>
<% row.value do %> <% row.with_value do %>
<%= simple_format( <%= simple_format(
duplicate_log_answer_label(question, log), duplicate_log_answer_label(question, log),
wrapper_tag: "span", wrapper_tag: "span",
@ -25,13 +25,13 @@
<% end %> <% end %>
<% end %> <% end %>
<% if @all_duplicates.many? %> <% if @all_duplicates.many? %>
<% row.action( <% row.with_action(
text: question.action_text(log), text: question.action_text(log),
href: change_duplicate_logs_action_href(log, question.page.id, @all_duplicates, @original_log.id), href: change_duplicate_logs_action_href(log, question.page.id, @all_duplicates, @original_log.id),
visually_hidden_text: question.check_answer_label.to_s.downcase, visually_hidden_text: question.check_answer_label.to_s.downcase,
) %> ) %>
<% else %> <% else %>
<% row.action( <% row.with_action(
text: question.action_text(log), text: question.action_text(log),
href: duplicate_logs_action_href(log, question.page.id, @original_log.id), href: duplicate_logs_action_href(log, question.page.id, @original_log.id),
visually_hidden_text: question.check_answer_label.to_s.downcase, visually_hidden_text: question.check_answer_label.to_s.downcase,

8
app/views/form/_check_answers_summary_list.html.erb

@ -1,9 +1,9 @@
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% questions.each do |question| %> <% questions.each do |question| %>
<% summary_list.row do |row| %> <% summary_list.with_row do |row| %>
<% row.key { get_question_label(question) } %> <% row.with_key { get_question_label(question) } %>
<% row.value do %> <% row.with_value do %>
<%= simple_format( <%= simple_format(
get_answer_label(question, @log), get_answer_label(question, @log),
wrapper_tag: "span", wrapper_tag: "span",
@ -26,7 +26,7 @@
<% end %> <% end %>
<% if @log.collection_period_open_for_editing? %> <% if @log.collection_period_open_for_editing? %>
<% row.action( <% row.with_action(
text: question.action_text(@log), text: question.action_text(@log),
href: action_href(@log, question.page.id, referrer), href: action_href(@log, question.page.id, referrer),
visually_hidden_text: question.check_answer_label.to_s.downcase, visually_hidden_text: question.check_answer_label.to_s.downcase,

10
app/views/locations/check_answers.html.erb

@ -19,18 +19,18 @@
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% display_location_attributes_for_check_answers(@location).each do |attr| %> <% display_location_attributes_for_check_answers(@location).each do |attr| %>
<% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %> <% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %>
<%= summary_list.row do |row| %> <%= summary_list.with_row do |row| %>
<% row.key { attr[:name] } %> <% row.with_key { attr[:name] } %>
<% if attr[:attribute].eql?("postcode") && @location.is_la_inferred %> <% if attr[:attribute].eql?("postcode") && @location.is_la_inferred %>
<% row.value do %> <% row.with_value do %>
<%= details_html(attr) %> <%= details_html(attr) %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= formatted_local_authority_timeline(@location) %></span> <span class="govuk-!-font-weight-regular app-!-colour-muted"><%= formatted_local_authority_timeline(@location) %></span>
<% end %> <% end %>
<% else %> <% else %>
<% row.value { details_html(attr) } %> <% row.with_value { details_html(attr) } %>
<% end %> <% end %>
<% if LocationPolicy.new(current_user, @location).update? %> <% if LocationPolicy.new(current_user, @location).update? %>
<% row.action(text: action_text_helper(attr, @location), href: location_edit_path(@location, attr[:attribute])) %> <% row.with_action(text: action_text_helper(attr, @location), href: location_edit_path(@location, attr[:attribute])) %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

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

@ -16,24 +16,24 @@
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<% display_location_attributes(@location).each do |attr| %> <% display_location_attributes(@location).each do |attr| %>
<% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %> <% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %>
<%= summary_list.row do |row| %> <%= summary_list.with_row do |row| %>
<% row.key { attr[:name] } %> <% row.with_key { attr[:name] } %>
<% if attr[:attribute].eql?("status") %> <% if attr[:attribute].eql?("status") %>
<%= row.value { status_tag_from_resource(@location) } %> <%= row.with_value { status_tag_from_resource(@location) } %>
<% elsif attr[:attribute].eql?("postcode") && @location.is_la_inferred %> <% elsif attr[:attribute].eql?("postcode") && @location.is_la_inferred %>
<% row.value do %> <% row.with_value do %>
<%= details_html(attr) %> <%= details_html(attr) %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= formatted_local_authority_timeline(@location) %></span> <span class="govuk-!-font-weight-regular app-!-colour-muted"><%= formatted_local_authority_timeline(@location) %></span>
<% end %> <% end %>
<% else %> <% else %>
<%= row.value { details_html(attr) } %> <%= row.with_value { details_html(attr) } %>
<% end %> <% end %>
<% if LocationPolicy.new(current_user, @location).update? %> <% if LocationPolicy.new(current_user, @location).update? %>
<% row.action(text: "Change", href: scheme_location_postcode_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "postcode" && current_user.support? %> <% row.with_action(text: "Change", href: scheme_location_postcode_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "postcode" && current_user.support? %>
<% row.action(text: "Change", href: scheme_location_name_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "name" %> <% row.with_action(text: "Change", href: scheme_location_name_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "name" %>
<% row.action(text: "Change", href: scheme_location_units_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "units" && current_user.support? %> <% row.with_action(text: "Change", href: scheme_location_units_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "units" && current_user.support? %>
<% row.action(text: "Change", href: scheme_location_type_of_unit_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "type_of_unit" && current_user.support? %> <% row.with_action(text: "Change", href: scheme_location_type_of_unit_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "type_of_unit" && current_user.support? %>
<% row.action(text: "Change", href: scheme_location_mobility_standards_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "mobility_standards" && current_user.support? %> <% row.with_action(text: "Change", href: scheme_location_mobility_standards_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "mobility_standards" && current_user.support? %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

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

@ -17,20 +17,20 @@
<%= organisation_name_row(user: current_user, organisation: @organisation, summary_list:) %> <%= organisation_name_row(user: current_user, organisation: @organisation, summary_list:) %>
<% display_organisation_attributes(@organisation).each do |attr| %> <% display_organisation_attributes(@organisation).each do |attr| %>
<% if can_edit_org?(current_user) && attr[:editable] %> <% if can_edit_org?(current_user) && attr[:editable] %>
<%= summary_list.row do |row| %> <%= summary_list.with_row do |row| %>
<% row.key { attr[:name] } %> <% row.with_key { attr[:name] } %>
<% row.value { details_html(attr) } %> <% row.with_value { details_html(attr) } %>
<% row.action( <% row.with_action(
visually_hidden_text: attr[:name].to_s.humanize.downcase, visually_hidden_text: attr[:name].to_s.humanize.downcase,
href: edit_organisation_path(@organisation), href: edit_organisation_path(@organisation),
html_attributes: { "data-qa": "change-#{attr[:name].downcase}" }, html_attributes: { "data-qa": "change-#{attr[:name].downcase}" },
) %> ) %>
<% end %> <% end %>
<% else %> <% else %>
<%= summary_list.row do |row| %> <%= summary_list.with_row do |row| %>
<% row.key { attr[:name] } %> <% row.with_key { attr[:name] } %>
<% row.value { details_html(attr) } %> <% row.with_value { details_html(attr) } %>
<% row.action %> <% row.with_action %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

78
app/views/users/show.html.erb

@ -21,95 +21,95 @@
Personal details Personal details
</h2> </h2>
<%= govuk_summary_list do |summary_list| %> <%= govuk_summary_list do |summary_list| %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Name" } row.with_key { "Name" }
row.value { @user.name } row.with_value { @user.name }
if UserPolicy.new(current_user, @user).edit_names? if UserPolicy.new(current_user, @user).edit_names?
row.action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" }) row.with_action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" })
else else
row.action row.with_action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Email address" } row.with_key { "Email address" }
row.value { @user.email } row.with_value { @user.email }
if UserPolicy.new(current_user, @user).edit_emails? if UserPolicy.new(current_user, @user).edit_emails?
row.action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" }) row.with_action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" })
else else
row.action row.with_action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Telephone number" } row.with_key { "Telephone number" }
row.value { @user.phone } row.with_value { @user.phone }
if UserPolicy.new(current_user, @user).edit_telephone_numbers? if UserPolicy.new(current_user, @user).edit_telephone_numbers?
row.action(visually_hidden_text: "telephone number", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-telephone-number" }) row.with_action(visually_hidden_text: "telephone number", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-telephone-number" })
else else
row.action row.with_action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Password" } row.with_key { "Password" }
row.value { "••••••••" } row.with_value { "••••••••" }
if UserPolicy.new(current_user, @user).edit_password? if UserPolicy.new(current_user, @user).edit_password?
row.action( row.with_action(
visually_hidden_text: "password", visually_hidden_text: "password",
href: edit_password_account_path, href: edit_password_account_path,
html_attributes: { "data-qa": "change-password" }, html_attributes: { "data-qa": "change-password" },
) )
else else
row.action row.with_action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Organisation" } row.with_key { "Organisation" }
row.value { @user.organisation.name } row.with_value { @user.organisation.name }
row.action row.with_action
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Role" } row.with_key { "Role" }
row.value { @user.role&.humanize } row.with_value { @user.role&.humanize }
if UserPolicy.new(current_user, @user).edit_roles? if UserPolicy.new(current_user, @user).edit_roles?
row.action( row.with_action(
visually_hidden_text: "role", visually_hidden_text: "role",
href: aliased_user_edit(@user, current_user), href: aliased_user_edit(@user, current_user),
html_attributes: { "data-qa": "change-role" }, html_attributes: { "data-qa": "change-role" },
) )
else else
row.action row.with_action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Data protection officer" } row.with_key { "Data protection officer" }
row.value { @user.is_data_protection_officer? ? "Yes" : "No" } row.with_value { @user.is_data_protection_officer? ? "Yes" : "No" }
if UserPolicy.new(current_user, @user).edit_dpo? if UserPolicy.new(current_user, @user).edit_dpo?
row.action( row.with_action(
visually_hidden_text: "if data protection officer", visually_hidden_text: "if data protection officer",
href: user_edit_dpo_path(@user), href: user_edit_dpo_path(@user),
html_attributes: { "data-qa": "change-data-protection-officer" }, html_attributes: { "data-qa": "change-data-protection-officer" },
) )
else else
row.action row.with_action
end end
end %> end %>
<%= summary_list.row do |row| <%= summary_list.with_row do |row|
row.key { "Key contact" } row.with_key { "Key contact" }
row.value { @user.is_key_contact? ? "Yes" : "No" } row.with_value { @user.is_key_contact? ? "Yes" : "No" }
if UserPolicy.new(current_user, @user).edit_key_contact? if UserPolicy.new(current_user, @user).edit_key_contact?
row.action( row.with_action(
visually_hidden_text: "if a key contact", visually_hidden_text: "if a key contact",
href: user_edit_key_contact_path(@user), href: user_edit_key_contact_path(@user),
html_attributes: { "data-qa": "change-key-contact" }, html_attributes: { "data-qa": "change-key-contact" },
) )
else else
row.action row.with_action
end end
end %> end %>
<% end %> <% end %>

Loading…
Cancel
Save