Browse Source

Use interruption_screen? method (#1238)

More safe than checking whether the question included value_check in their name
pull/1169/head
Jack 2 years ago committed by GitHub
parent
commit
1d624131d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/form.rb
  2. 2
      app/views/form/page.html.erb

2
app/models/form.rb

@ -61,7 +61,7 @@ class Form
page_ids = subsection_for_page(page).pages.map(&:id) page_ids = subsection_for_page(page).pages.map(&:id)
page_index = page_ids.index(page.id) page_index = page_ids.index(page.id)
page_id = if page.id.include?("value_check") && log[page.questions[0].id] == 1 && page.routed_to?(log, current_user) page_id = if page.interruption_screen? && log[page.questions[0].id] == 1 && page.routed_to?(log, current_user)
previous_page(page_ids, page_index, log, current_user) previous_page(page_ids, page_index, log, current_user)
else else
page_ids[page_index + 1] page_ids[page_index + 1]

2
app/views/form/page.html.erb

@ -44,7 +44,7 @@
<%= f.hidden_field :page, value: @page.id %> <%= f.hidden_field :page, value: @page.id %>
<div class="govuk-button-group"> <div class="govuk-button-group">
<% if !@page.id.include?("value_check") && if request.query_parameters["referrer"] != "check_answers" %> <% if !@page.interruption_screen? && if request.query_parameters["referrer"] != "check_answers" %>
<%= f.govuk_submit "Save and continue" %> <%= f.govuk_submit "Save and continue" %>
<%= govuk_link_to "Skip for now", send(@log.form.next_page_redirect_path(@page, @log, current_user), @log) %> <%= govuk_link_to "Skip for now", send(@log.form.next_page_redirect_path(@page, @log, current_user), @log) %>
<% else %> <% else %>

Loading…
Cancel
Save