diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb
index b5efe1e04..b483560f7 100644
--- a/app/controllers/locations_controller.rb
+++ b/app/controllers/locations_controller.rb
@@ -24,7 +24,11 @@ class LocationsController < ApplicationController
if params[:location].present?
@location.postcode = params[:location][:postcode]
@location.save!
- redirect_to scheme_location_name_path(@scheme, @location)
+ if params[:referrer] == "check_answers"
+ redirect_to scheme_location_check_answers_path(@scheme, @location)
+ else
+ redirect_to scheme_location_name_path(@scheme, @location)
+ end
end
end
diff --git a/app/helpers/locations_helper.rb b/app/helpers/locations_helper.rb
index 1073e18d7..5ae0a0d5e 100644
--- a/app/helpers/locations_helper.rb
+++ b/app/helpers/locations_helper.rb
@@ -67,7 +67,7 @@ module LocationsHelper
scheme_location_type_of_unit_path(location.scheme, location, referrer: "check_answers")
when "mobility_standards"
scheme_location_mobility_standards_path(location.scheme, location, referrer: "check_answers")
- when "avaliability"
+ when "availability"
scheme_location_availability_path(location.scheme, location, referrer: "check_answers")
end
end
diff --git a/app/views/locations/availability.erb b/app/views/locations/availability.erb
index b7659f28d..071561bd4 100644
--- a/app/views/locations/availability.erb
+++ b/app/views/locations/availability.erb
@@ -3,11 +3,11 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
- href: scheme_location_mobility_standards_path(@scheme, @location),
+ href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location) : scheme_location_mobility_standards_path(@scheme, @location),
) %>
<% end %>
-<%= form_for(@location, method: :patch, url: scheme_location_availability_path(@scheme, @location)) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_availability_path(@scheme, @location, referrer: params[:referrer])) do |f| %>
<%= govuk_summary_list do |summary_list| %>
<% display_location_attributes(@location).each do |attr| %>
- <% next if attr[:attribute] == "code" %>
+ <% next if %w[location_code status].include? attr[:attribute] %>
<%= summary_list.row do |row| %>
<% row.key { attr[:name] } %>
<% row.value { attr[:attribute].eql?("status") ? status_tag(attr[:value]) : details_html(attr) } %>
diff --git a/app/views/locations/mobility_standards.html.erb b/app/views/locations/mobility_standards.html.erb
index 4023d5675..15a6b8fad 100644
--- a/app/views/locations/mobility_standards.html.erb
+++ b/app/views/locations/mobility_standards.html.erb
@@ -3,11 +3,11 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
- href: scheme_location_type_of_unit_path(@scheme, @location),
+ href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location) : scheme_location_type_of_unit_path(@scheme, @location),
) %>
<% end %>
-<%= form_for(@location, method: :patch, url: scheme_location_mobility_standards_path(@scheme, @location)) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_mobility_standards_path(@scheme, @location, referrer: params[:referrer])) do |f| %>
<%= f.govuk_error_summary %>
@@ -22,8 +22,13 @@
legend: nil %>
- <%= f.govuk_submit "Continue" %>
+ <% if params[:referrer] == "check_answers" %>
+ <%= f.govuk_submit "Save changes" %>
+ <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location), secondary: true %>
+ <% else %>
+ <%= f.govuk_submit "Save and continue" %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
+ <% end %>
diff --git a/app/views/locations/name.html.erb b/app/views/locations/name.html.erb
index 56af18469..9b07523cf 100644
--- a/app/views/locations/name.html.erb
+++ b/app/views/locations/name.html.erb
@@ -3,11 +3,11 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
- href: scheme_location_postcode_path(@scheme, @location),
+ href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location) : scheme_location_postcode_path(@scheme, @location),
) %>
<% end %>
-<%= form_for(@location, method: :patch, url: scheme_location_name_path(@scheme, @location)) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_name_path(@scheme, @location, referrer: params[:referrer])) do |f| %>
<%= f.govuk_error_summary %>
@@ -19,8 +19,13 @@
hint: { text: I18n.t("hints.location.name") } %>
- <%= f.govuk_submit "Continue" %>
+ <% if params[:referrer] == "check_answers" %>
+ <%= f.govuk_submit "Save changes" %>
+ <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location), secondary: true %>
+ <% else %>
+ <%= f.govuk_submit "Save and continue" %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
+ <% end %>
diff --git a/app/views/locations/postcode.html.erb b/app/views/locations/postcode.html.erb
index e4cfc1723..a1102bed0 100644
--- a/app/views/locations/postcode.html.erb
+++ b/app/views/locations/postcode.html.erb
@@ -3,11 +3,11 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
- href: scheme_locations_path(@scheme),
+ href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location) : scheme_locations_path(@scheme),
) %>
<% end %>
-<%= form_for(@location, method: :patch, url: scheme_location_postcode_path(@scheme, @location)) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_postcode_path(@scheme, @location, referrer: params[:referrer])) do |f| %>
<%= f.govuk_error_summary %>
@@ -20,8 +20,13 @@
width: 5 %>
- <%= f.govuk_submit "Continue" %>
+ <% if params[:referrer] == "check_answers" %>
+ <%= f.govuk_submit "Save changes" %>
+ <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location), secondary: true %>
+ <% else %>
+ <%= f.govuk_submit "Save and continue" %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
+ <% end %>
diff --git a/app/views/locations/type_of_unit.html.erb b/app/views/locations/type_of_unit.html.erb
index 00faaa085..74322a35a 100644
--- a/app/views/locations/type_of_unit.html.erb
+++ b/app/views/locations/type_of_unit.html.erb
@@ -3,11 +3,11 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
- href: scheme_location_units_path(@scheme, @location),
+ href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location) : scheme_location_units_path(@scheme, @location),
) %>
<% end %>
-<%= form_for(@location, method: :patch, url: scheme_location_type_of_unit_path(@scheme, @location)) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_type_of_unit_path(@scheme, @location, referrer: params[:referrer])) do |f| %>
<%= f.govuk_error_summary %>
@@ -21,8 +21,13 @@
legend: nil %>
- <%= f.govuk_submit "Continue" %>
+ <% if params[:referrer] == "check_answers" %>
+ <%= f.govuk_submit "Save changes" %>
+ <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location), secondary: true %>
+ <% else %>
+ <%= f.govuk_submit "Save and continue" %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
+ <% end %>
diff --git a/app/views/locations/units.html.erb b/app/views/locations/units.html.erb
index a60081ed4..9118a40f8 100644
--- a/app/views/locations/units.html.erb
+++ b/app/views/locations/units.html.erb
@@ -3,11 +3,11 @@
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
- href: scheme_location_name_path(@scheme, @location),
+ href: params[:referrer] == "check_answers" ? scheme_location_check_answers_path(@scheme, @location) : scheme_location_name_path(@scheme, @location),
) %>
<% end %>
-<%= form_for(@location, method: :patch, url: scheme_location_units_path(@scheme, @location)) do |f| %>
+<%= form_for(@location, method: :patch, url: scheme_location_units_path(@scheme, @location, referrer: params[:referrer])) do |f| %>
<%= f.govuk_error_summary %>
@@ -21,8 +21,13 @@
autofocus: true %>
- <%= f.govuk_submit "Continue" %>
+ <% if params[:referrer] == "check_answers" %>
+ <%= f.govuk_submit "Save changes" %>
+ <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location), secondary: true %>
+ <% else %>
+ <%= f.govuk_submit "Save and continue" %>
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
+ <% end %>