Skip to content

Commit

Permalink
Merge pull request #7247 from DFE-Digital/email-updates
Browse files Browse the repository at this point in the history
Email updates
  • Loading branch information
KyleMacPherson authored Nov 18, 2024
2 parents 462dcad + 9d07ee5 commit 7cde35c
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 4 deletions.
15 changes: 15 additions & 0 deletions app/helpers/notify_views_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ def home_page_link(text = t("app.title"))
notify_link(url, text)
end

def writing_job_application_advice_link(text)
url = jobseeker_guides_write_a_great_teaching_job_application_in_five_steps_url
notify_link(url, text)
end

def teaching_job_interview_link(text)
url = jobseeker_guides_how_to_approach_a_teaching_job_interview_url
notify_link(url, text)
end

def teaching_job_interview_lesson_link(text)
url = jobseeker_guides_prepare_for_a_teaching_job_interview_lesson_url
notify_link(url, text)
end

def invitation_to_apply_vacancy_link(vacancy)
url = job_url(vacancy)
url_with_utm_params = job_url(vacancy, **utm_params)
Expand Down
4 changes: 4 additions & 0 deletions app/models/vacancy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ def distance_in_miles_to(search_coordinates)
end
end

def is_a_teaching_or_middle_leader_role?
job_roles.intersect?(%w[teacher head_of_year_or_phase head_of_department_or_curriculum sendco other_leadership])
end

private

def calculate_distance(search_coordinates, geolocation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<%= @job_application.further_instructions %>
<% end %>
<% if @vacancy.is_a_teaching_or_middle_leader_role? %>
<%= t(".read_advice_from") %>
<%= t(".guidance", link: teaching_job_interview_link(t(".teaching_job_interview"))) %>
<%= t(".guidance", link: teaching_job_interview_lesson_link(t(".teaching_interview_lesson"))) %>
<% end %>

# <%= t(".more_info.heading") %>
<%= t(".more_info.description", email: notify_mail_to(@contact_email)) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<%= t(".next_steps.description", organisation_name: @organisation_name, link: jobseeker_job_applications_link) %>
<% if @vacancy.is_a_teaching_or_middle_leader_role? %>
<%= t(".read_advice_from") %>
<%= t(".guidance", link: teaching_job_interview_link(t(".teaching_job_interview"))) %>
<%= t(".guidance", link: teaching_job_interview_lesson_link(t(".teaching_interview_lesson"))) %>
<% end %>

# <%= t(".more_info.heading") %>
<%= t(".more_info.description", email: notify_mail_to(@contact_email)) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<%= @job_application.rejection_reasons %>
<% end %>
<% if @vacancy.is_a_teaching_or_middle_leader_role? %>
<%= t(".advice", link: writing_job_application_advice_link(t(".application_advice_link_text"))) %>
<% end %>

# <%= t(".more_info.heading") %>
<%= t(".more_info.description", email: notify_mail_to(@contact_email)) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<%= t(".body", link_to: notify_link(jobseekers_job_application_review_url(@job_application), t(".complete"))) %>
<% if @vacancy.is_a_teaching_or_middle_leader_role? %>
<%= t(".advice", link: writing_job_application_advice_link(t(".application_advice_link_text"))) %>
<% end %>
<%= t(".outro", link_to: home_page_link) %>
<%= t("shared.jobseeker_footer", home_page_link: home_page_link) %>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<%= notify_link(job_url(@vacancy), t(".apply_for_link", job_title: @vacancy.job_title)) %>
<% if @vacancy.is_a_teaching_or_middle_leader_role? %>
<%= t(".advice", link: writing_job_application_advice_link(t(".application_advice_link_text"))) %>
<% end %>
<%= t(".to_find_the_right_job") %>
<%= t("shared.jobseeker_footer", home_page_link: home_page_link) %>
22 changes: 18 additions & 4 deletions config/locales/mailers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ en:
shared: &job_application_mailer_shared
intro: Your application for %{job_title} at %{organisation_name}
paragraph1: The school will be in touch to let you know what the next steps are. If you have any further questions, you can contact them at %{email}.
paragraph2: Search and %{link}
apply_link_text: apply for more jobs on Teaching Vacancies.
paragraph2: Search and %{link}.
apply_link_text: apply for more jobs on Teaching Vacancies
more_info:
heading: Still have questions?
description: If you would like more information you can contact the school at %{email}.
Expand All @@ -94,6 +94,10 @@ en:
heading: You have been shortlisted for %{job_title} at %{organisation_name}
instructions: What happens next
subject: Your job application has been shortlisted
read_advice_from: "Read advice from experienced teachers and school leaders on preparing for your:"
teaching_job_interview: "teaching job interview"
teaching_interview_lesson: "teaching interview lesson"
guidance: "- %{link}"
application_submitted:
<<: *job_application_mailer_shared
heading: Your application has been sent to %{organisation_name}
Expand All @@ -104,10 +108,16 @@ en:
touch to let you know.
link_text: view your application
subject: Your job application has been submitted
read_advice_from: "Read advice from experienced teachers and school leaders on preparing for your:"
teaching_job_interview: "teaching job interview"
teaching_interview_lesson: "teaching interview lesson"
guidance: "- %{link}"
application_unsuccessful:
<<: *job_application_mailer_shared
feedback: Feedback from the school
heading: Unfortunately your application was not successful this time
advice: To improve your application for next time, read advice from experienced teachers and school leaders on %{link}.
application_advice_link_text: writing a great application
subject: Your job application has been unsuccessful
job_listing_ended_early:
body: |
Expand All @@ -130,16 +140,20 @@ en:
subject: Apply for %{job_title} before %{date}
intro: The deadline to apply for %{job_title} at %{school} is %{date}
body: You started an application for this role, but have not submitted it yet. If you want to apply, there is still time to %{link_to}.
advice: Read advice from experienced teachers and school leaders on %{link}.
application_advice_link_text: writing a great application
outro: Or search on %{link_to}
complete: complete your application
apply_for_more_jobs: apply for more jobs on Teaching Vacancies
unapplied_saved_vacancy:
subject: "%{days} days left to apply for %{job_title}"
salutation: "Hi %{name}"
vacancy_closes: "%{job_title} at %{school} closes on %{date}"
saved_but_not_applied: You saved this job but have not applied to it yet
saved_but_not_applied: You saved this job but have not applied to it yet.
apply_for_link: "Apply for %{job_title} on Teaching Vacancies"
to_find_the_right_job: "To find the right job, remember to always check Teaching Vacancies"
to_find_the_right_job: "To find the right job, remember to always check Teaching Vacancies."
advice: Read advice from experienced teachers and school leaders on %{link}.
application_advice_link_text: writing a great application

subscription_mailer:
confirmation:
Expand Down
44 changes: 44 additions & 0 deletions spec/models/vacancy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -577,4 +577,48 @@
expect(subject.publish_on).to eq(nil)
end
end

describe "#is_a_teaching_or_middle_leader_role?" do
let(:vacancy) { create(:vacancy, job_roles: job_roles) }

context "when job_roles includes a teaching role" do
let(:job_roles) { ["teacher"] }

it "returns true" do
expect(vacancy.is_a_teaching_or_middle_leader_role?).to be true
end
end

context "when job_roles includes a middle leader role" do
let(:job_roles) { ["head_of_year_or_phase"] }

it "returns true" do
expect(vacancy.is_a_teaching_or_middle_leader_role?).to be true
end
end

context "when job_roles includes multiple valid roles" do
let(:job_roles) { ["teacher", "head_of_department_or_curriculum"] }

it "returns true" do
expect(vacancy.is_a_teaching_or_middle_leader_role?).to be true
end
end

context "when job_roles does not include any teaching or middle leader role" do
let(:job_roles) { ["administration_hr_data_and_finance"] }

it "returns false" do
expect(vacancy.is_a_teaching_or_middle_leader_role?).to be false
end
end

context "when job_roles is empty" do
let(:job_roles) { [] }

it "returns false" do
expect(vacancy.is_a_teaching_or_middle_leader_role?).to be false
end
end
end
end

0 comments on commit 7cde35c

Please sign in to comment.