Browse Source

feat: design change to save behaviour

pull/1034/head
natdeanlewissoftwire 4 years ago
parent
commit
ac12a91e4d
  1. 8
      app/models/location.rb
  2. 4
      app/views/locations/availability.erb
  3. 4
      app/views/locations/check_answers.html.erb
  4. 4
      app/views/locations/mobility_standards.html.erb
  5. 6
      app/views/locations/name.html.erb
  6. 4
      app/views/locations/postcode.html.erb
  7. 4
      app/views/locations/type_of_unit.html.erb
  8. 4
      app/views/locations/units.html.erb

8
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!

4
app/views/locations/availability.erb

@ -22,10 +22,10 @@
<div class="govuk-button-group">
<% 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 %>
</div>
</div>

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

@ -29,8 +29,6 @@
</div>
</div>
<div class="govuk-button-group">
<% 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 %>
</div>

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

@ -24,10 +24,10 @@
<div class="govuk-button-group">
<% 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 %>
</div>
</div>

6
app/views/locations/name.html.erb

@ -28,13 +28,13 @@
<div class="govuk-button-group">
<% 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 %>
</div>
</div>

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

@ -26,10 +26,10 @@
<div class="govuk-button-group">
<% 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 %>
</div>
</div>

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

@ -23,10 +23,10 @@
<div class="govuk-button-group">
<% 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 %>
</div>
</div>

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

@ -23,10 +23,10 @@
<div class="govuk-button-group">
<% 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 %>
</div>
</div>

Loading…
Cancel
Save