Browse Source

Use path helpers

pull/797/head
Kat 3 years ago
parent
commit
87f58356ce
  1. 4
      app/helpers/check_answers_helper.rb
  2. 4
      app/views/locations/edit.html.erb
  3. 1
      config/routes.rb

4
app/helpers/check_answers_helper.rb

@ -18,9 +18,9 @@ module CheckAnswersHelper
def get_location_change_link_href(scheme, location) def get_location_change_link_href(scheme, location)
if location.confirmed? if location.confirmed?
"/schemes/#{scheme.id}/locations/#{location.id}/edit-name" location_edit_name_path(id: scheme.id, location_id: location.id)
else else
"/schemes/#{scheme.id}/locations/#{location.id}/edit" location_edit_path(id: scheme.id, location_id: location.id)
end end
end end

4
app/views/locations/edit.html.erb

@ -7,7 +7,9 @@
) %> ) %>
<% end %> <% 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| %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>

1
config/routes.rb

@ -48,6 +48,7 @@ Rails.application.routes.draw do
member do member do
resources :locations do resources :locations do
get "edit-name", to: "locations#edit_name" get "edit-name", to: "locations#edit_name"
get "edit", to: "locations#edit"
end end
end end
end end

Loading…
Cancel
Save