diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index f5233d33a..760c08ab0 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -18,9 +18,9 @@ module CheckAnswersHelper def get_location_change_link_href(scheme, location) if location.confirmed? - "/schemes/#{scheme.id}/locations/#{location.id}/edit-name" + location_edit_name_path(id: scheme.id, location_id: location.id) else - "/schemes/#{scheme.id}/locations/#{location.id}/edit" + location_edit_path(id: scheme.id, location_id: location.id) end end diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb index 6fe2496b2..77eb96bb4 100644 --- a/app/views/locations/edit.html.erb +++ b/app/views/locations/edit.html.erb @@ -7,7 +7,9 @@ ) %> <% end %> -<%= form_for(@location, method: :patch, url: location_path) do |f| %> +<%= render partial: "organisations/headings", locals: { main: "Add a location to this scheme", sub: @scheme.service_name } %> + +<%= form_for(@location, method: :patch, url: location_path(location_id: @location.id)) do |f| %>
<%= f.govuk_error_summary %> diff --git a/config/routes.rb b/config/routes.rb index a6b0b9654..65130cd35 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,6 +48,7 @@ Rails.application.routes.draw do member do resources :locations do get "edit-name", to: "locations#edit_name" + get "edit", to: "locations#edit" end end end