From ac12a91e4d8d3730d0083e5ff06076cee0db5998 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 6 Dec 2022 14:29:18 +0000 Subject: [PATCH] feat: design change to save behaviour --- app/models/location.rb | 8 +------- app/views/locations/availability.erb | 4 ++-- app/views/locations/check_answers.html.erb | 4 +--- app/views/locations/mobility_standards.html.erb | 4 ++-- app/views/locations/name.html.erb | 6 +++--- app/views/locations/postcode.html.erb | 4 ++-- app/views/locations/type_of_unit.html.erb | 4 ++-- app/views/locations/units.html.erb | 4 ++-- 8 files changed, 15 insertions(+), 23 deletions(-) diff --git a/app/models/location.rb b/app/models/location.rb index 6679eb27d..a8c51c537 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -430,13 +430,7 @@ class Location < ApplicationRecord end def validate_confirmed - if confirmed == true && incomplete? - self.confirmed = false - end - end - - def incomplete? - [postcode, name, location_admin_district, location_code, units, type_of_unit, mobility_type, startdate].any?(&:blank?) + self.confirmed = [postcode, name, location_admin_district, location_code, units, type_of_unit, mobility_type].all?(&:present?) end def confirmed! diff --git a/app/views/locations/availability.erb b/app/views/locations/availability.erb index 264c81869..279c5110c 100644 --- a/app/views/locations/availability.erb +++ b/app/views/locations/availability.erb @@ -22,10 +22,10 @@
<% if params[:referrer] == "check_answers" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% else %> <%= f.govuk_submit "Save and continue" %> - <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> + <%= govuk_link_to "Skip for now", scheme_location_check_answers_path(@scheme, @location), secondary: true %> <% end %>
diff --git a/app/views/locations/check_answers.html.erb b/app/views/locations/check_answers.html.erb index d74fae2e4..11272b5a9 100644 --- a/app/views/locations/check_answers.html.erb +++ b/app/views/locations/check_answers.html.erb @@ -29,8 +29,6 @@
- <% if !@location.incomplete? %> - <%= govuk_button_to "Add this location", scheme_location_confirm_path(@scheme, @location, route: params[:route]), method: :patch %> - <% end %> + <%= govuk_button_to "Save and return to locations", scheme_location_confirm_path(@scheme, @location, route: params[:route]), method: :patch %> <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
diff --git a/app/views/locations/mobility_standards.html.erb b/app/views/locations/mobility_standards.html.erb index 1d536c35b..42bdb4bcf 100644 --- a/app/views/locations/mobility_standards.html.erb +++ b/app/views/locations/mobility_standards.html.erb @@ -24,10 +24,10 @@
<% if params[:referrer] == "check_answers" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% else %> <%= f.govuk_submit "Save and continue" %> - <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> + <%= govuk_link_to "Skip for now", scheme_location_availability_path(@scheme, @location), secondary: true %> <% end %>
diff --git a/app/views/locations/name.html.erb b/app/views/locations/name.html.erb index 3d70699b1..322a1da22 100644 --- a/app/views/locations/name.html.erb +++ b/app/views/locations/name.html.erb @@ -28,13 +28,13 @@
<% if params[:referrer] == "check_answers" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% elsif params[:referrer] == "details" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_path(@scheme, @location), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_path(@scheme, @location), secondary: true %> <% else %> <%= f.govuk_submit "Save and continue" %> - <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> + <%= govuk_link_to "Skip for now", scheme_location_units_path(@scheme, @location), secondary: true %> <% end %>
diff --git a/app/views/locations/postcode.html.erb b/app/views/locations/postcode.html.erb index b1df113be..5ede463ad 100644 --- a/app/views/locations/postcode.html.erb +++ b/app/views/locations/postcode.html.erb @@ -26,10 +26,10 @@
<% if params[:referrer] == "check_answers" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% else %> <%= f.govuk_submit "Save and continue" %> - <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> + <%= govuk_link_to "Skip for now", scheme_location_name_path(@scheme, @location), secondary: true %> <% end %>
diff --git a/app/views/locations/type_of_unit.html.erb b/app/views/locations/type_of_unit.html.erb index 9d8f3883d..5ff4ed3f1 100644 --- a/app/views/locations/type_of_unit.html.erb +++ b/app/views/locations/type_of_unit.html.erb @@ -23,10 +23,10 @@
<% if params[:referrer] == "check_answers" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% else %> <%= f.govuk_submit "Save and continue" %> - <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> + <%= govuk_link_to "Skip for now", scheme_location_mobility_standards_path(@scheme, @location), secondary: true %> <% end %>
diff --git a/app/views/locations/units.html.erb b/app/views/locations/units.html.erb index 7edaf5769..30a9b3eff 100644 --- a/app/views/locations/units.html.erb +++ b/app/views/locations/units.html.erb @@ -23,10 +23,10 @@
<% if params[:referrer] == "check_answers" %> <%= f.govuk_submit "Save changes" %> - <%= govuk_button_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> + <%= govuk_link_to "Cancel", scheme_location_check_answers_path(@scheme, @location, route: params[:route]), secondary: true %> <% else %> <%= f.govuk_submit "Save and continue" %> - <%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %> + <%= govuk_link_to "Skip for now", scheme_location_type_of_unit_path(@scheme, @location), secondary: true %> <% end %>