diff --git a/app/helpers/tab_nav_helper.rb b/app/helpers/tab_nav_helper.rb index 3ef211401..e8802d86c 100644 --- a/app/helpers/tab_nav_helper.rb +++ b/app/helpers/tab_nav_helper.rb @@ -11,6 +11,11 @@ module TabNavHelper [govuk_link_to(link_text, "/schemes/#{location.scheme.id}/locations/#{location.id}/edit", method: :patch), "Location #{location.name}"].join("\n") end + def edit_location_cell(location) + link_text = location.postcode + [govuk_link_to(link_text, "/schemes/#{location.scheme.id}/locations/#{location.id}/edit-name", method: :patch), "Location #{location.name}"].join("\n") + end + def scheme_cell(scheme) link_text = scheme.service_name [govuk_link_to(link_text, scheme), "Scheme #{scheme.primary_client_group}"].join("\n") diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index 6d3cc3de3..9c7793fea 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -36,7 +36,7 @@ <%= table.body do |body| %> <%= body.row do |row| %> <% row.cell(text: location.id) %> - <% row.cell(text: location.postcode) %> + <% row.cell(text: simple_format(edit_location_cell(location), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> <% row.cell(text: location.total_units) %> <% row.cell(text: simple_format("#{location.type_of_unit}#{location.wheelchair_adaptation == 'Yes' ? "\nWith wheelchair adaptations" : ''}")) %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 7b18a6fce..c7635c860 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -45,7 +45,9 @@ Rails.application.routes.draw do get "edit-name", to: "schemes#edit_name" member do - resources :locations + resources :locations do + get "edit-name", to: "locations#edit-name" + end end end