diff --git a/app/components/check_answers_summary_list_card_component.html.erb b/app/components/check_answers_summary_list_card_component.html.erb index a2fad6445..946092a46 100644 --- a/app/components/check_answers_summary_list_card_component.html.erb +++ b/app/components/check_answers_summary_list_card_component.html.erb @@ -9,9 +9,9 @@
<%= govuk_summary_list do |summary_list| %> <% applicable_questions.each do |question| %> - <% summary_list.row do |row| %> - <% row.key { get_question_label(question) } %> - <% row.value do %> + <% summary_list.with_row do |row| %> + <% row.with_key { get_question_label(question) } %> + <% row.with_value do %> <%= simple_format( get_answer_label(question), wrapper_tag: "span", @@ -34,7 +34,7 @@ <% end %> <% if @log.collection_period_open_for_editing? %> - <% row.action( + <% row.with_action( text: question.action_text(log), href: action_href(log, question.page.id), visually_hidden_text: question.check_answer_label.to_s.downcase, diff --git a/app/helpers/data_sharing_agreement_helper.rb b/app/helpers/data_sharing_agreement_helper.rb index d2e2e074d..283f5abd8 100644 --- a/app/helpers/data_sharing_agreement_helper.rb +++ b/app/helpers/data_sharing_agreement_helper.rb @@ -1,8 +1,8 @@ module DataSharingAgreementHelper def data_sharing_agreement_row(user:, organisation:, summary_list:) - summary_list.row do |row| - row.key { "Data Sharing Agreement" } - row.action( + summary_list.with_row do |row| + row.with_key { "Data Sharing Agreement" } + row.with_action( href: data_sharing_agreement_organisation_path(organisation), text: "View agreement", ) diff --git a/app/helpers/organisations_helper.rb b/app/helpers/organisations_helper.rb index 850742afc..cf53bd244 100644 --- a/app/helpers/organisations_helper.rb +++ b/app/helpers/organisations_helper.rb @@ -23,17 +23,17 @@ module OrganisationsHelper end def organisation_name_row(user:, organisation:, summary_list:) - summary_list.row do |row| - row.key { "Name" } - row.value { organisation.name } + summary_list.with_row do |row| + row.with_key { "Name" } + row.with_value { organisation.name } if user.support? - row.action( + row.with_action( visually_hidden_text: organisation.name.humanize.downcase, href: edit_organisation_path(organisation), html_attributes: { "data-qa": "change-#{organisation.name.downcase}" }, ) else - row.action + row.with_action end end end diff --git a/app/views/duplicate_logs/_duplicate_log_check_answers.erb b/app/views/duplicate_logs/_duplicate_log_check_answers.erb index 44b788959..91deb10c8 100644 --- a/app/views/duplicate_logs/_duplicate_log_check_answers.erb +++ b/app/views/duplicate_logs/_duplicate_log_check_answers.erb @@ -2,10 +2,10 @@
<%= govuk_summary_list do |summary_list| %> <% log.duplicate_check_questions(current_user).each do |question| %> - <% summary_list.row do |row| %> - <% row.key { duplicate_log_question_label(question) } %> + <% summary_list.with_row do |row| %> + <% row.with_key { duplicate_log_question_label(question) } %> - <% row.value do %> + <% row.with_value do %> <%= simple_format( duplicate_log_answer_label(question, log), wrapper_tag: "span", @@ -25,13 +25,13 @@ <% end %> <% end %> <% if @all_duplicates.many? %> - <% row.action( + <% row.with_action( text: question.action_text(log), 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, ) %> <% else %> - <% row.action( + <% row.with_action( text: question.action_text(log), href: duplicate_logs_action_href(log, question.page.id, @original_log.id), visually_hidden_text: question.check_answer_label.to_s.downcase, diff --git a/app/views/form/_check_answers_summary_list.html.erb b/app/views/form/_check_answers_summary_list.html.erb index 4d1bbd8a4..59d6c9bd1 100644 --- a/app/views/form/_check_answers_summary_list.html.erb +++ b/app/views/form/_check_answers_summary_list.html.erb @@ -1,9 +1,9 @@ <%= govuk_summary_list do |summary_list| %> <% questions.each do |question| %> - <% summary_list.row do |row| %> - <% row.key { get_question_label(question) } %> + <% summary_list.with_row do |row| %> + <% row.with_key { get_question_label(question) } %> - <% row.value do %> + <% row.with_value do %> <%= simple_format( get_answer_label(question, @log), wrapper_tag: "span", @@ -26,7 +26,7 @@ <% end %> <% if @log.collection_period_open_for_editing? %> - <% row.action( + <% row.with_action( text: question.action_text(@log), href: action_href(@log, question.page.id, referrer), visually_hidden_text: question.check_answer_label.to_s.downcase, diff --git a/app/views/locations/check_answers.html.erb b/app/views/locations/check_answers.html.erb index 7d45eb158..63a48d4d5 100644 --- a/app/views/locations/check_answers.html.erb +++ b/app/views/locations/check_answers.html.erb @@ -19,18 +19,18 @@ <%= govuk_summary_list do |summary_list| %> <% display_location_attributes_for_check_answers(@location).each do |attr| %> <% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %> - <%= summary_list.row do |row| %> - <% row.key { attr[:name] } %> + <%= summary_list.with_row do |row| %> + <% row.with_key { attr[:name] } %> <% if attr[:attribute].eql?("postcode") && @location.is_la_inferred %> - <% row.value do %> + <% row.with_value do %> <%= details_html(attr) %> <%= formatted_local_authority_timeline(@location) %> <% end %> <% else %> - <% row.value { details_html(attr) } %> + <% row.with_value { details_html(attr) } %> <% end %> <% 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 %> diff --git a/app/views/locations/show.html.erb b/app/views/locations/show.html.erb index 54758b00f..9b11e4052 100644 --- a/app/views/locations/show.html.erb +++ b/app/views/locations/show.html.erb @@ -16,24 +16,24 @@ <%= govuk_summary_list do |summary_list| %> <% display_location_attributes(@location).each do |attr| %> <% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %> - <%= summary_list.row do |row| %> - <% row.key { attr[:name] } %> + <%= summary_list.with_row do |row| %> + <% row.with_key { attr[:name] } %> <% 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 %> - <% row.value do %> + <% row.with_value do %> <%= details_html(attr) %> <%= formatted_local_authority_timeline(@location) %> <% end %> <% else %> - <%= row.value { details_html(attr) } %> + <%= row.with_value { details_html(attr) } %> <% end %> <% 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.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.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_postcode_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "postcode" && current_user.support? %> + <% row.with_action(text: "Change", href: scheme_location_name_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "name" %> + <% row.with_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_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_mobility_standards_path(@scheme, @location, referrer: "details")) if attr[:attribute] == "mobility_standards" && current_user.support? %> <% end %> <% end %> <% end %> diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index 9cfecda26..48084dbf8 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -17,20 +17,20 @@ <%= organisation_name_row(user: current_user, organisation: @organisation, summary_list:) %> <% display_organisation_attributes(@organisation).each do |attr| %> <% if can_edit_org?(current_user) && attr[:editable] %> - <%= summary_list.row do |row| %> - <% row.key { attr[:name] } %> - <% row.value { details_html(attr) } %> - <% row.action( + <%= summary_list.with_row do |row| %> + <% row.with_key { attr[:name] } %> + <% row.with_value { details_html(attr) } %> + <% row.with_action( visually_hidden_text: attr[:name].to_s.humanize.downcase, href: edit_organisation_path(@organisation), html_attributes: { "data-qa": "change-#{attr[:name].downcase}" }, ) %> <% end %> <% else %> - <%= summary_list.row do |row| %> - <% row.key { attr[:name] } %> - <% row.value { details_html(attr) } %> - <% row.action %> + <%= summary_list.with_row do |row| %> + <% row.with_key { attr[:name] } %> + <% row.with_value { details_html(attr) } %> + <% row.with_action %> <% end %> <% end %> <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 3414cdd35..895a2fe79 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -21,95 +21,95 @@ Personal details <%= govuk_summary_list do |summary_list| %> - <%= summary_list.row do |row| - row.key { "Name" } - row.value { @user.name } + <%= summary_list.with_row do |row| + row.with_key { "Name" } + row.with_value { @user.name } 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 - row.action + row.with_action end end %> - <%= summary_list.row do |row| - row.key { "Email address" } - row.value { @user.email } + <%= summary_list.with_row do |row| + row.with_key { "Email address" } + row.with_value { @user.email } 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 - row.action + row.with_action end end %> - <%= summary_list.row do |row| - row.key { "Telephone number" } - row.value { @user.phone } + <%= summary_list.with_row do |row| + row.with_key { "Telephone number" } + row.with_value { @user.phone } 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 - row.action + row.with_action end end %> - <%= summary_list.row do |row| - row.key { "Password" } - row.value { "••••••••" } + <%= summary_list.with_row do |row| + row.with_key { "Password" } + row.with_value { "••••••••" } if UserPolicy.new(current_user, @user).edit_password? - row.action( + row.with_action( visually_hidden_text: "password", href: edit_password_account_path, html_attributes: { "data-qa": "change-password" }, ) else - row.action + row.with_action end end %> - <%= summary_list.row do |row| - row.key { "Organisation" } - row.value { @user.organisation.name } - row.action + <%= summary_list.with_row do |row| + row.with_key { "Organisation" } + row.with_value { @user.organisation.name } + row.with_action end %> - <%= summary_list.row do |row| - row.key { "Role" } - row.value { @user.role&.humanize } + <%= summary_list.with_row do |row| + row.with_key { "Role" } + row.with_value { @user.role&.humanize } if UserPolicy.new(current_user, @user).edit_roles? - row.action( + row.with_action( visually_hidden_text: "role", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-role" }, ) else - row.action + row.with_action end end %> - <%= summary_list.row do |row| - row.key { "Data protection officer" } - row.value { @user.is_data_protection_officer? ? "Yes" : "No" } + <%= summary_list.with_row do |row| + row.with_key { "Data protection officer" } + row.with_value { @user.is_data_protection_officer? ? "Yes" : "No" } if UserPolicy.new(current_user, @user).edit_dpo? - row.action( + row.with_action( visually_hidden_text: "if data protection officer", href: user_edit_dpo_path(@user), html_attributes: { "data-qa": "change-data-protection-officer" }, ) else - row.action + row.with_action end end %> - <%= summary_list.row do |row| - row.key { "Key contact" } - row.value { @user.is_key_contact? ? "Yes" : "No" } + <%= summary_list.with_row do |row| + row.with_key { "Key contact" } + row.with_value { @user.is_key_contact? ? "Yes" : "No" } if UserPolicy.new(current_user, @user).edit_key_contact? - row.action( + row.with_action( visually_hidden_text: "if a key contact", href: user_edit_key_contact_path(@user), html_attributes: { "data-qa": "change-key-contact" }, ) else - row.action + row.with_action end end %> <% end %>