From 911576574fcd85dc6fa608e717a86c1c6089899a Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 2 Dec 2022 10:37:26 +0000 Subject: [PATCH] refactor: erblinting --- app/views/locations/check_answers.html.erb | 10 +++++----- app/views/locations/index.html.erb | 12 ++++++++++-- app/views/locations/local_authority.html.erb | 4 ++-- app/views/locations/name.html.erb | 5 +++-- app/views/locations/postcode.html.erb | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/views/locations/check_answers.html.erb b/app/views/locations/check_answers.html.erb index 80bc66b6b..0018144d8 100644 --- a/app/views/locations/check_answers.html.erb +++ b/app/views/locations/check_answers.html.erb @@ -5,11 +5,11 @@ <%= govuk_back_link( text: "Back", href: case params[:route] - when "locations" - scheme_locations_path(@scheme) - else - :back - end, + when "locations" + scheme_locations_path(@scheme) + else + :back + end, ) %> <% end %> diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index 054b223c5..5380941aa 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -50,7 +50,11 @@ <% @locations.each do |location| %> <%= table.body do |body| %> <%= body.row do |row| %> - <% row.cell(text: simple_format(location_cell_postcode(location, location.confirmed ? scheme_location_path(@scheme, location) : location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location)), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> + <% row.cell(text: simple_format(location_cell_postcode(location, if location.confirmed + scheme_location_path(@scheme, location) + else + location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location) + end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: location.id) %> <% row.cell(text: status_tag(location.status)) %> <% end %> @@ -95,7 +99,11 @@ <%= table.body do |body| %> <%= body.row do |row| %> <% row.cell(text: location.id) %> - <% row.cell(text: simple_format(location_cell_postcode(location, location.confirmed ? scheme_location_path(@scheme, location) : location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location)), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> + <% row.cell(text: simple_format(location_cell_postcode(location, if location.confirmed + scheme_location_path(@scheme, location) + else + location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location) + end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: location.units) %> <% row.cell do %> <%= simple_format(location.type_of_unit) %> diff --git a/app/views/locations/local_authority.html.erb b/app/views/locations/local_authority.html.erb index f4ea960aa..767beb3c7 100644 --- a/app/views/locations/local_authority.html.erb +++ b/app/views/locations/local_authority.html.erb @@ -8,7 +8,7 @@ scheme_location_check_answers_path(@scheme, @location, route: params[:route]) else scheme_location_postcode_path(@scheme, @location, route: params[:route], referrer: params[:referrer]) - end + end, ) %> <% end %> @@ -27,7 +27,7 @@ "data-controller": %w[conditional-filter accessible-autocomplete] %>
- <% if params[:referrer] == "check_answers" || params[:referrer] == "check_local_authority"%> + <% if params[:referrer] == "check_answers" || params[:referrer] == "check_local_authority" %> <%= f.govuk_submit "Save changes" %> <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% else %> diff --git a/app/views/locations/name.html.erb b/app/views/locations/name.html.erb index ff3bc6131..3d70699b1 100644 --- a/app/views/locations/name.html.erb +++ b/app/views/locations/name.html.erb @@ -3,9 +3,10 @@ <% content_for :before_content do %> <%= govuk_back_link( text: "Back", - href: if params[:referrer] == "check_answers" + href: case params[:referrer] + when "check_answers" scheme_location_check_answers_path(@scheme, @location, route: params[:route]) - elsif params[:referrer] == "details" + when "details" scheme_location_path(@scheme, @location) else scheme_location_postcode_path(@scheme, @location, route: params[:route]) diff --git a/app/views/locations/postcode.html.erb b/app/views/locations/postcode.html.erb index 461f91d84..b1df113be 100644 --- a/app/views/locations/postcode.html.erb +++ b/app/views/locations/postcode.html.erb @@ -7,7 +7,7 @@ scheme_location_check_answers_path(@scheme, @location, route: params[:route]) else scheme_locations_path(@scheme) - end + end, ) %> <% end %>