Browse Source

update paths

pull/863/head
Kat 3 years ago committed by baarkerlounger
parent
commit
bfffe3386d
  1. 5
      app/controllers/form_controller.rb
  2. 2
      app/views/form/check_answers.html.erb
  3. 2
      app/views/form/page.html.erb
  4. 2
      spec/features/form/form_navigation_spec.rb

5
app/controllers/form_controller.rb

@ -133,10 +133,7 @@ private
next_page = @log.form.next_page(@page, @log, current_user)
previous_page = @log.form.previous_page(page_ids, page_index, @log, current_user)
if next_page.to_s.include?("value_check") || next_page == previous_page
binding.pry
"lettings_log_void_or_renewal_date_path"
"#{@log.class.name.underscore}_#{next_page}"
return "/logs/#{@log.id}/#{next_page.dasherize}?referrer=check_answers"
return send("#{@log.class.name.underscore}_#{next_page}_path", @log, { referrer: "check_answers" })
else
return send("#{@log.model_name.param_key}_#{@log.form.subsection_for_page(@page).id}_check_answers_path", @log)
end

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

@ -32,7 +32,7 @@
<%= f.govuk_submit "Save and return to log" do %>
<% next_incomplete_section_redirect_path = @log.form.next_incomplete_section_redirect_path(subsection, @log) %>
<% if @log.status == "in_progress" && next_incomplete_section_redirect_path != "error" %>
<%= govuk_button_link_to "Save and go to next incomplete section", "/logs/#{@log.id}/#{next_incomplete_section_redirect_path}", secondary: true %>
<%= govuk_button_link_to "Save and go to next incomplete section", send("#{@log.class.name.underscore}_#{next_incomplete_section_redirect_path.underscore.gsub("/","_")}_path", @log) , secondary: true %>
<% end %>
<% end %>
<% end %>

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

@ -45,7 +45,7 @@
<%= govuk_link_to "Skip for now", send(@log.form.next_page_redirect_path(@page, @log, current_user), @log) %>
<% else %>
<%= f.govuk_submit "Save changes" %>
<%= govuk_link_to "Cancel", "/logs/#{@log.id}/setup/check-answers" %>
<%= govuk_link_to "Cancel", send("#{@log.class.name.underscore}_#{@page.subsection.id}_check_answers_path", @log) %>
<% end %>
<% end %>
</div>

2
spec/features/form/form_navigation_spec.rb

@ -115,7 +115,7 @@ RSpec.describe "Form Navigation" do
it "a question page has a link allowing you to cancel your input and return to the check answers page" do
visit("logs/#{id}/tenant-code-test?referrer=check_answers")
click_link(text: "Cancel")
expect(page).to have_current_path("/logs/#{id}/setup/check-answers")
expect(page).to have_current_path("/logs/#{id}/household-characteristics/check-answers")
end
context "when clicking save and continue on a mandatory question with no input" do

Loading…
Cancel
Save