diff --git a/app/helpers/toggle_active_location_helper.rb b/app/helpers/toggle_active_location_helper.rb index ffb809a22..1fdda6416 100644 --- a/app/helpers/toggle_active_location_helper.rb +++ b/app/helpers/toggle_active_location_helper.rb @@ -1,9 +1,9 @@ module ToggleActiveLocationHelper - def toggle_location_form_path(action, scheme_id, location_id) + def toggle_location_form_path(action, location) if action == "deactivate" - scheme_location_new_deactivation_path(scheme_id:, location_id:) + scheme_location_new_deactivation_path(location.scheme, location) else - scheme_location_reactivate_path(scheme_id:, location_id:) + scheme_location_reactivate_path(location.scheme, location) end end diff --git a/app/views/locations/show.html.erb b/app/views/locations/show.html.erb index a13bbb2c5..5ed049d08 100644 --- a/app/views/locations/show.html.erb +++ b/app/views/locations/show.html.erb @@ -25,8 +25,8 @@ <% if FeatureToggle.location_toggle_enabled? %> <% if @location.active? || @location.reactivating_soon? %> - <%= govuk_button_link_to "Deactivate this location", scheme_location_new_deactivation_path(scheme_id: @scheme.id, location_id: @location.id), warning: true %> + <%= govuk_button_link_to "Deactivate this location", scheme_location_new_deactivation_path(@scheme, @location), warning: true %> <% else %> - <%= govuk_button_link_to "Reactivate this location", scheme_location_new_reactivation_path(scheme_id: @scheme.id, location_id: @location.id) %> + <%= govuk_button_link_to "Reactivate this location", scheme_location_new_reactivation_path(@scheme, @location) %> <% end %> <% end %> diff --git a/app/views/locations/toggle_active.html.erb b/app/views/locations/toggle_active.html.erb index c8a4fd9c5..017aa93f4 100644 --- a/app/views/locations/toggle_active.html.erb +++ b/app/views/locations/toggle_active.html.erb @@ -8,7 +8,7 @@ ) %> <% end %> -<%= form_with model: @location, url: toggle_location_form_path(action, @location.scheme.id, @location.id), method: "patch", local: true do |f| %> +<%= form_with model: @location, url: toggle_location_form_path(action, @location), method: "patch", local: true do |f| %>
<% collection_start_date = FormHandler.instance.current_collection_start_date %>