Browse Source

Update paths

pull/1007/head
Kat 4 years ago
parent
commit
7e71e28767
  1. 6
      app/helpers/toggle_active_location_helper.rb
  2. 4
      app/views/locations/show.html.erb
  3. 2
      app/views/locations/toggle_active.html.erb

6
app/helpers/toggle_active_location_helper.rb

@ -1,9 +1,9 @@
module ToggleActiveLocationHelper module ToggleActiveLocationHelper
def toggle_location_form_path(action, scheme_id, location_id) def toggle_location_form_path(action, location)
if action == "deactivate" if action == "deactivate"
scheme_location_new_deactivation_path(scheme_id:, location_id:) scheme_location_new_deactivation_path(location.scheme, location)
else else
scheme_location_reactivate_path(scheme_id:, location_id:) scheme_location_reactivate_path(location.scheme, location)
end end
end end

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

@ -25,8 +25,8 @@
</div> </div>
<% if FeatureToggle.location_toggle_enabled? %> <% if FeatureToggle.location_toggle_enabled? %>
<% if @location.active? || @location.reactivating_soon? %> <% 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 %> <% 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 %>
<% end %> <% end %>

2
app/views/locations/toggle_active.html.erb

@ -8,7 +8,7 @@
) %> ) %>
<% end %> <% 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| %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<% collection_start_date = FormHandler.instance.current_collection_start_date %> <% collection_start_date = FormHandler.instance.current_collection_start_date %>

Loading…
Cancel
Save