Skip to content

Commit

Permalink
Remove email previews
Browse files Browse the repository at this point in the history
We've decided to remove these emails previews as they're not useful and
sometimes show inaccurate information. Rather than fixing the previews
we will remove them.
  • Loading branch information
thomasleese committed Mar 1, 2024
1 parent b96e169 commit aaeca99
Show file tree
Hide file tree
Showing 27 changed files with 61 additions and 463 deletions.
20 changes: 0 additions & 20 deletions app/assets/stylesheets/_email_preview.scss

This file was deleted.

1 change: 0 additions & 1 deletion app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ $moj-images-path: "/";
@import "_application_forms";
@import "_checkbox_search_filter";
@import "_description_list";
@import "_email_preview";
@import "_environments";
@import "_search_results";
@import "_support";
Expand Down
11 changes: 0 additions & 11 deletions app/components/preview_mailer/component.html.erb

This file was deleted.

16 changes: 0 additions & 16 deletions app/components/preview_mailer/component.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ def update_age_range_subjects
end
end

def preview
authorize %i[assessor_interface assessment_recommendation], :edit?
end

def edit_confirm
authorize %i[assessor_interface assessment_recommendation], :edit?
@form = AssessmentConfirmationForm.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def update

if @form.save
redirect_to [
:preview,
:confirm,
:assessor_interface,
application_form,
assessment,
Expand All @@ -60,10 +60,6 @@ def update
end
end

def preview
authorize %i[assessor_interface assessment_recommendation], :edit?
end

def edit_confirm
authorize %i[assessor_interface assessment_recommendation], :edit?
@form = AssessmentConfirmationForm.new
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/assessor_interface/assessments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ def assessment
def update_redirect_path(recommendation)
if recommendation == "request_further_information"
[
:preview,
:new,
:assessor_interface,
application_form,
assessment,
:further_information_requests,
:further_information_request,
]
else
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ module AssessorInterface
class FurtherInformationRequestsController < BaseController
include HistoryTrackable

before_action only: %i[preview new create] do
before_action only: %i[new create] do
authorize %i[assessor_interface further_information_request]
end

before_action except: %i[preview new create] do
before_action except: %i[new create] do
authorize [:assessor_interface, further_information_request]
end

before_action :load_application_form_and_assessment,
only: %i[preview new edit]
before_action :load_new_further_information_request, only: %i[preview new]
before_action :load_application_form_and_assessment, only: %i[new edit]
before_action :load_view_object, only: %i[edit update]

def preview
end

def new
@further_information_request =
assessment.further_information_requests.build(
items:
FurtherInformationRequestItemsFactory.call(
assessment_sections: assessment.sections,
),
)
end

def create
Expand Down Expand Up @@ -73,16 +75,6 @@ def load_application_form_and_assessment
@assessment = assessment
end

def load_new_further_information_request
@further_information_request =
assessment.further_information_requests.build(
items:
FurtherInformationRequestItemsFactory.call(
assessment_sections: assessment.sections,
),
)
end

def load_view_object
@view_object = view_object
end
Expand Down
52 changes: 0 additions & 52 deletions app/lib/mailer_preview.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ def create?
user.assess_permission
end

alias_method :preview?, :new?

def update?
user.assess_permission
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
end
end %>

<div class="govuk-button-group">
<%= govuk_button_link_to "Continue", [:preview, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] %>
<%= render "shared/assessor_interface/cancel_link" %>
</div>
<%= form_with url: [:confirm, :assessor_interface, @application_form, @assessment, :assessment_recommendation_award] do |f| %>
<% render "shared/assessor_interface/continue_cancel_button", f: %>
<% end %>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
<% content_for :page_title, "Further information request email preview" %>
<% content_for :back_link_url, back_history_path(default: preview_assessor_interface_application_form_assessment_further_information_requests_path) %>
<% 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)) %>

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

<%= render(PreviewMailer::Component.new(
mailer_class: TeacherMailer,
name: :further_information_requested,
application_form: @application_form,
)) %>
<% @further_information_request.items.group_by(&:failure_reason_key).each do |failure_reason_key, items| %>
<% if failure_reason_key == "school_details_cannot_be_verified" %>
<section class="app-further-information-request-item">
<h2 class="govuk-heading-m">Reason for request</h2>
<% if items.size == 1 %>
<p class="govuk-body">We were unable to verify the details for <%= items.first.work_history.school_name %>.</p>
<% else %>
<p class="govuk-body">We were unable to verify the details for:</p>
<ul class="govuk-list govuk-list--bullet">
<% items.each do |item| %>
<li><%= item.work_history.school_name %></li>
<% end %>
</ul>
<% end %>
<h2 class="govuk-heading-m">Note to applicant</h2>

<%= form_with model: [:assessor_interface, @application_form, @assessment, @further_information_request] do |f| %>
<%= f.govuk_submit "Send email to applicant" do %>
<%= govuk_button_link_to "Back to overview", assessor_interface_application_form_path(@application_form), secondary: true %>
<%= govuk_inset_text do %>
<%= simple_format items.first.failure_reason_assessor_feedback %>
<% end %>
</section>
<% else %>
<% items.each do |item| %>
<section class="app-further-information-request-item">
<p class="govuk-body"><%= t(item.failure_reason_key, scope: %i[assessor_interface assessment_sections failure_reasons as_statement]) %></p>

<h2 class="govuk-heading-m">Note to applicant</h2>

<%= govuk_inset_text do %>
<%= simple_format item.failure_reason_assessor_feedback %>
<% end %>
</section>
<% end %>
<% end %>
<% end %>

<%= form_with model: [:assessor_interface, @application_form, @assessment, @further_information_request] do |f| %>
<% render "shared/assessor_interface/continue_cancel_button", f: %>
<% end %>

This file was deleted.

8 changes: 0 additions & 8 deletions config/locales/assessor_interface.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ en:
heading: Confirm age range and subjects
edit_age_range_subjects:
heading: Edit age range and subjects
preview:
heading: Check the email
subheading: This screen shows how the email to the applicant will look.
description: Make sure you’re happy with the content, then select ‘Continue’, or select ‘Cancel’ to return to the application.
edit_confirm:
legend: Award this QTS application?
hint: Select ‘Yes’ to confirm you want to award this application. If you’re not sure, or you need to check something, select ‘No’.
Expand All @@ -72,10 +68,6 @@ en:
english_language_proficiency: English language proficiency
work_history: Work history
professional_standing: Professional standing
preview:
heading: Check the email
subheading: This screen shows how the email to the applicant will look.
description: Make sure you’re happy with the content, then select ‘Continue’, or select ‘Cancel’ to return to the application.
edit_confirm:
legend: Decline this QTS application?
hint: Select ‘Yes’ to confirm you want to decline this application. If you’re not sure, or you need to check something, select ‘No’.
Expand Down
Loading

0 comments on commit aaeca99

Please sign in to comment.