Skip to content

Commit

Permalink
Fix back links on review and verify pages
Browse files Browse the repository at this point in the history
This ensures that we go to the right place when clicking on the back
link.
  • Loading branch information
thomasleese committed Jan 18, 2024
1 parent 362617d commit 8c956ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix("Review reference", error: @form.errors.any?) %>
<% content_for :back_link_url, review_assessor_interface_application_form_assessment_path %>
<% content_for :back_link_url, review_assessor_interface_application_form_assessment_path(@application_form, @assessment) %>

<%= form_with model: @form, url: [:review, :assessor_interface, @application_form, @assessment, @reference_request] do |f| %>
<%= f.govuk_error_summary %>
Expand All @@ -13,7 +13,7 @@
<% if @reference_request.expired? && @reference_request.received? %>
<%= govuk_inset_text do %>
<p>This reference’s status has changed from <%= render(StatusTag::Component.new("overdue")) %> to <%= render(StatusTag::Component.new("received")) %>.</p>
<p><%= govuk_link_to "View reference details", [:verify, :assessor_interface, @application_form, @assessment, @reference_request] %></p>
<p><%= govuk_link_to "View reference details", verify_assessor_interface_application_form_assessment_reference_request_path(@application_form, @assessment, @reference_request, back_to: "review") %></p>
<% end %>

<%= govuk_details(summary_text: "See previous notes") do %>
Expand All @@ -26,7 +26,7 @@
<%= govuk_inset_text do %>
<h3 class="govuk-heading-s">Internal note</h3>
<%= simple_format @reference_request.verify_note %>
<p><%= govuk_link_to "View reference details", [:verify, :assessor_interface, @application_form, @assessment, @reference_request] %></p>
<p><%= govuk_link_to "View reference details", verify_assessor_interface_application_form_assessment_reference_request_path(@application_form, @assessment, @reference_request, back_to: "review") %></p>
<% end %>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<% application_form = @reference_request.application_form %>
<% assessment = application_form.assessment %>

<% content_for :page_title, title_with_error_prefix(t(".title"), error: @form.errors.any?) %>
<% content_for :back_link_url, assessor_interface_application_form_path(application_form) %>
<% content_for :back_link_url, params[:back_to] == "review" ?
review_assessor_interface_application_form_assessment_reference_request_path(@application_form, @assessment, @reference_request) :
assessor_interface_application_form_assessment_reference_requests_path(@application_form, @assessment) %>

<% work_history = @reference_request.work_history %>
<% can_edit_work_history = policy([:assessor_interface, work_history]).edit? %>

<%= form_with model: @form, url: [:verify, :assessor_interface, application_form, @reference_request.assessment, @reference_request] do |f| %>
<%= form_with model: @form, url: [:verify, :assessor_interface, @application_form, @assessment, @reference_request] do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-xl"><%= t(".title") %></h1>
Expand All @@ -30,21 +29,21 @@
row.with_value { work_history.contact_name }

if can_edit_work_history
row.with_action(text: "Change", href: [:edit, :assessor_interface, application_form, work_history])
row.with_action(text: "Change", href: [:edit, :assessor_interface, @application_form, work_history])
end
end

if can_edit_work_history
summary_list.with_row do |row|
row.with_key { "Job title of reference" }
row.with_value { work_history.contact_job }
row.with_action(text: "Change", href: [:edit, :assessor_interface, application_form, work_history])
row.with_action(text: "Change", href: [:edit, :assessor_interface, @application_form, work_history])
end

summary_list.with_row do |row|
row.with_key { "Email address of reference" }
row.with_value { work_history.contact_email }
row.with_action(text: "Change", href: [:edit, :assessor_interface, application_form, work_history])
row.with_action(text: "Change", href: [:edit, :assessor_interface, @application_form, work_history])
end
end
end %>
Expand All @@ -69,7 +68,7 @@
<% end %>

<%= f.govuk_submit do %>
<%= govuk_link_to "Cancel", [:assessor_interface, application_form] %>
<%= govuk_link_to "Cancel", [:assessor_interface, @application_form] %>
<% end %>
<% end %>
<% end %>

0 comments on commit 8c956ae

Please sign in to comment.