Skip to content

Commit

Permalink
Merge pull request #2248 from DFE-Digital/standardise-back-links
Browse files Browse the repository at this point in the history
Simplify back links in assessor interface
  • Loading branch information
thomasleese authored Jun 12, 2024
2 parents eef1066 + c4f0621 commit b4f1828
Show file tree
Hide file tree
Showing 48 changed files with 38 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class AssessmentRecommendationAwardController < BaseController
include HistoryTrackable

before_action :ensure_can_award
before_action :load_assessment_and_application_form
before_action :load_important_notes, only: %i[edit update]
Expand All @@ -12,8 +10,6 @@ class AssessmentRecommendationAwardController < BaseController
authorize %i[assessor_interface assessment_recommendation]
end

skip_before_action :track_history, only: :show

def show
redirect_to [
:edit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

module AssessorInterface
class AssessmentRecommendationDeclineController < BaseController
include HistoryTrackable

before_action :ensure_can_decline
before_action :load_assessment_and_application_form

before_action only: %i[show edit update] do
authorize %i[assessor_interface assessment_recommendation]
end

skip_before_action :track_history, only: :show

def show
redirect_to [
:edit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

module AssessorInterface
class AssessmentRecommendationReviewController < BaseController
include HistoryTrackable

before_action :ensure_can_review
before_action :load_assessment_and_application_form

before_action only: %i[show edit update] do
authorize %i[assessor_interface assessment_recommendation]
end

skip_before_action :track_history, only: :show

def show
redirect_to [
:edit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AssessmentRecommendationVerifyController < BaseController
end

skip_before_action :track_history, only: :show
define_history_origin :verify_qualifications
define_history_check :edit

def show
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class AssessmentSectionsController < BaseController
include HistoryTrackable

before_action { authorize [:assessor_interface, assessment_section] }

def show
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/assessor_interface/assessments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class AssessmentsController < BaseController
include HistoryTrackable

before_action :load_assessment_and_application_form

before_action only: %i[edit update] do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class AssessorAssignmentsController < BaseController
include HistoryTrackable

before_action { authorize %i[assessor_interface staff_assignment] }

def new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class FurtherInformationRequestsController < BaseController
include HistoryTrackable

before_action only: %i[new create] do
authorize %i[assessor_interface further_information_request]
end
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/assessor_interface/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class NotesController < BaseController
include HistoryTrackable

before_action { authorize %i[assessor_interface note] }

def new
Expand All @@ -17,7 +15,7 @@ def create
)

if @form.save
redirect_to history_stack.pop_back ||
redirect_to params[:next].presence ||
[:assessor_interface, application_form]
else
render :new, status: :unprocessable_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

module AssessorInterface
class ProfessionalStandingRequestsController < BaseController
include HistoryTrackable

before_action :set_variables

before_action do
authorize [:assessor_interface, professional_standing_request]
end

define_history_origin :show

def show
render layout: "full_from_desktop"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

module AssessorInterface
class ReferenceRequestsController < BaseController
include HistoryTrackable

before_action :set_individual_variables, except: :index
skip_before_action :track_history, only: :resend_email

define_history_origin :index

def index
authorize %i[assessor_interface reference_request]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class ReviewerAssignmentsController < BaseController
include HistoryTrackable

before_action { authorize %i[assessor_interface staff_assignment] }

def new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module AssessorInterface
class WorkHistoriesController < BaseController
include HistoryTrackable

before_action { authorize [:assessor_interface, work_history] }

def edit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = "Change email for ‘#{application_form_full_name(@application_form)}’" %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:email, :assessor_interface, @application_form] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = "Change name for ‘#{application_form_full_name(@application_form)}’" %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:name, :assessor_interface, @application_form] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, "Application" %>
<% content_for :back_link_url, back_history_path(origin: true, default: assessor_interface_application_forms_path) %>
<% content_for :back_link_url, assessor_interface_application_forms_path %>

<% application_form = @view_object.application_form %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
end %>

<% content_for :page_title, title %>
<% content_for :back_link_url, back_history_path(origin: true, default: assessor_interface_application_form_path(@view_object.application_form)) %>

<% if @view_object.application_form.awarded_at.present? %>
<%= govuk_panel(text: title) %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, "Application history" %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@view_object.application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@view_object.application_form) %>

<h1 class="govuk-heading-xl">Application history</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, "Withdraw application" %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-l">Are you sure you want to withdraw this application?</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, t(".heading") %>
<% content_for :back_link_url, back_history_path(default: edit_assessor_interface_application_form_assessment_assessment_recommendation_award_path) %>
<% content_for :back_link_url, edit_assessor_interface_application_form_assessment_assessment_recommendation_award_path %>

<h1 class="govuk-heading-xl"><%= t(".heading") %></h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix(t(".heading"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:assessor_interface, @application_form, @assessment, :assessment_recommendation_award], method: :put do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix(t(".heading"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: age_range_subjects_assessor_interface_application_form_assessment_assessment_recommendation_award_path) %>
<% content_for :back_link_url, age_range_subjects_assessor_interface_application_form_assessment_assessment_recommendation_award_path %>

<%= form_with model: @form, url: [:age_range_subjects, :edit, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix(t(".legend"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, age_range_subjects_assessor_interface_application_form_assessment_assessment_recommendation_award_path %>

<%= form_with model: @form, url: [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix(t(".heading"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<% preliminary_decline = @assessment.unknown? && @assessment.any_preliminary_section_failed? %>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix(t(".legend"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, edit_assessor_interface_application_form_assessment_assessment_recommendation_decline_path %>

<%= form_with model: @form, url: [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_decline] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, t(".heading") %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-xl"><%= t(".heading") %></h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = "Do you want to verify qualifications?" %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:verify_qualifications, :assessor_interface, @application_form, @assessment, :assessment_recommendation_verify] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% @application_form = @view_object.application_form %>

<% content_for :page_title, title_with_error_prefix(t(".title.#{preliminary_key}.#{section_key}"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= render "linked_application_forms",
application_forms_contact_email_used_as_teacher: @view_object.work_history_application_forms_contact_email_used_as_teacher,
Expand Down
2 changes: 1 addition & 1 deletion app/views/assessor_interface/assessments/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:assessor_interface, @application_form, @assessment], method: :put do |f| %>
<%= f.govuk_error_summary %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/assessor_interface/assessments/review.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = "Review verifications" %>

<% content_for :page_title, title %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-xl"><%= title %></h1>

Expand Down
2 changes: 1 addition & 1 deletion app/views/assessor_interface/assessments/rollback.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, "Reverse decision" %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-l">Are you sure you want to reverse this decision?</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix("Select an assessor", error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= render "shared/assessor_header", title: "Select an assessor", application_form: @application_form %>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix(t(".title"), error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-xl"><%= t(".title") %></h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, "Check the further information you’re asking the applicant for" %>
<% content_for :back_link_url, back_history_path(default: edit_assessor_interface_application_form_assessment_path(@application_form, @assessment)) %>
<% content_for :back_link_url, edit_assessor_interface_application_form_assessment_path(@application_form, @assessment) %>

<h1 class="govuk-heading-xl">Check the information you’re asking the applicant for</h1>

Expand Down
4 changes: 3 additions & 1 deletion app/views/assessor_interface/notes/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% content_for :page_title, title_with_error_prefix("Add a note", error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, params[:next].presence || assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:assessor_interface, @application_form, :notes] do |f| %>
<%= hidden_field_tag :next, params[:next] %>

<%= f.govuk_error_summary %>

<%= f.govuk_text_area :text, label: { tag: "h1", size: "l" }, rows: 5 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = region_certificate_name(@application_form.region) %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<%= form_with model: @form, url: [:locate, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% title = "Request LoPS verification" %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_assessment_professional_standing_request_path %>

<%= form_with model: @form, url: [:request, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix("Review LoPS", error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: review_assessor_interface_application_form_assessment_path(@application_form, @assessment)) %>
<% 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, :professional_standing_request] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix("Record LoPS response", error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_assessment_professional_standing_request_path %>

<%= form_with model: @form, url: [:verify, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, title_with_error_prefix("Send for review", error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: verify_assessor_interface_application_form_assessment_professional_standing_request_path) %>
<% content_for :back_link_url, verify_assessor_interface_application_form_assessment_professional_standing_request_path %>

<%= form_with model: @form, url: [:verify_failed, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %>
<%= f.govuk_error_summary %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :page_title, "Verify LoPS" %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_path(@application_form)) %>
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %>

<h1 class="govuk-heading-xl">Verify LoPS</h1>

Expand Down
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, back_history_path(default: review_assessor_interface_application_form_assessment_path(@application_form, @assessment)) %>
<% 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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% title = can_update_verify_reference_request ? "Review reference" : "View reference" %>

<% content_for :page_title, title_with_error_prefix(title, error: @form.errors.any?) %>
<% content_for :back_link_url, back_history_path(default: assessor_interface_application_form_assessment_reference_requests_path) %>
<% content_for :back_link_url, assessor_interface_application_form_assessment_reference_requests_path %>

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

0 comments on commit b4f1828

Please sign in to comment.