Skip to content

Commit

Permalink
Merge pull request #7381 from DFE-Digital/cpd-changes
Browse files Browse the repository at this point in the history
Add course length to training and CPD section of profile and job applciation
  • Loading branch information
KyleMacPherson authored Jan 13, 2025
2 parents 859c004 + b220e49 commit d817f6b
Show file tree
Hide file tree
Showing 24 changed files with 136 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def form_attributes
when "create", "update"
training_and_cpd_form_params
when "edit"
training_and_cpd.slice(:name, :provider, :grade, :year_awarded)
training_and_cpd.slice(:name, :provider, :grade, :year_awarded, :course_length)
end
end

def training_and_cpd_form_params
params.require(:jobseekers_training_and_cpd_form)
.permit(:name, :provider, :grade, :year_awarded)
.permit(:name, :provider, :grade, :year_awarded, :course_length)
end

def training_and_cpd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def form_attributes
when "create", "update"
training_and_cpd_form_params
when "edit"
training_and_cpd.slice(:name, :provider, :grade, :year_awarded)
training_and_cpd.slice(:name, :provider, :grade, :year_awarded, :course_length)
end
end

def training_and_cpd_form_params
params.require(:jobseekers_training_and_cpd_form)
.permit(:name, :provider, :grade, :year_awarded)
.permit(:name, :provider, :grade, :year_awarded, :course_length)
end

def training_and_cpd
Expand Down
4 changes: 2 additions & 2 deletions app/form_models/jobseekers/training_and_cpd_form.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Jobseekers::TrainingAndCpdForm
include ActiveModel::Model

attr_accessor :name, :provider, :grade, :year_awarded
attr_accessor :name, :provider, :grade, :year_awarded, :course_length

validates :name, :provider, :year_awarded, presence: true
validates :name, :provider, :year_awarded, :course_length, presence: true
end
4 changes: 2 additions & 2 deletions app/helpers/pdf_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def add_secondary_qualification_details(pdf, qualification)
secondary_qualification_data = [
["Name:", qualification.name],
["Grade:", qualification.grade],
["Year Awarded:", qualification.year],
["Date completed:", qualification.year],
].reject { |row| row[1].blank? }

render_table(pdf, secondary_qualification_data)
Expand All @@ -119,7 +119,7 @@ def add_general_qualification_details(pdf, qualification)
["Qualification Name:", qualification.name],
["Institution:", qualification.institution],
["Grade:", qualification.grade],
["Year Awarded:", qualification.year],
["Date completed:", qualification.year],
].reject { |row| row[1].blank? }

render_table(pdf, general_qualification_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= render DetailComponent.new title: training.name do |detail|
- detail.with_body do
= govuk_summary_list classes: "govuk-!-margin-bottom-0" do |summary_list|
- attributes = %w[name provider grade year_awarded]
- attributes = %w[name provider grade year_awarded course_length]
- attributes.each do |attribute|
- if training[attribute].present?
- summary_list.with_row do |row|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
- if training.grade.present?
span class="govuk-!-display-inline-block govuk-!-margin-left-1"
= "(#{training.grade})"
p class="govuk-!-margin-bottom-1" = training.course_length
p.govuk-caption-m
= "#{training.provider}, #{training.year_awarded}"
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
h1.govuk-heading-xl = t(".heading")

= form_for form, url: jobseekers_job_application_training_and_cpd_path, method: :put do |f|
p.govuk-body = t(".description")
p.govuk-body = t(".example_intro")
ul.govuk-list.govuk-list--bullet
li = t(".example1")
li = t(".example2")
li = t(".example3")
li = t(".example4")
= f.govuk_error_summary

= f.govuk_text_field :name, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :provider, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_text_field :year_awarded, label: { size: "s" }, type: "number", width: 4, hint: { text: t(".hint") }
= f.govuk_text_field :course_length, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_submit t("buttons.save_and_continue")

.govuk-button-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
h1.govuk-heading-xl = t(".heading")

= form_for form, url: jobseekers_job_application_training_and_cpds_path(job_application), method: :post do |f|
p.govuk-body = t(".description")
p.govuk-body = t(".example_intro")
ul.govuk-list.govuk-list--bullet
li = t(".example1")
li = t(".example2")
li = t(".example3")
li = t(".example4")

= f.govuk_error_summary

= f.govuk_text_field :name, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :provider, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_text_field :course_length, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :year_awarded, label: { size: "s" }, type: "number", width: 4, hint: { text: t(".hint") }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_submit t("buttons.save_and_continue")

.govuk-button-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- row.with_key text: "Institution"
- row.with_value text: qualification.institution
- summary_list.with_row do |row|
- row.with_key text: "Year awarded"
- row.with_key text: "Date completed"
- row.with_value text: qualification.year
- summary_list.with_row do |row|
- row.with_key text: t("jobseekers.qualifications.subjects_and_grades")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
- row.with_value text: training_and_cpd.provider

- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.grade")
- row.with_value text: training_and_cpd.grade
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.course_length")
- row.with_value text: training_and_cpd.course_length

- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.year_awarded")
- row.with_value text: training_and_cpd.year_awarded

- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.grade")
- row.with_value text: training_and_cpd.grade

= f.govuk_submit "Delete training"

.govuk-button-group
Expand Down
11 changes: 10 additions & 1 deletion app/views/jobseekers/profiles/training_and_cpds/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
h1.govuk-heading-xl = "Edit training and continuing professional development (CPD)"

= form_for form, url: jobseekers_profile_training_and_cpd_path, method: :put do |f|
p.govuk-body = t(".description")
p.govuk-body = t(".example_intro")
ul.govuk-list.govuk-list--bullet
li = t(".example1")
li = t(".example2")
li = t(".example3")
li = t(".example4")

= f.govuk_error_summary

= f.govuk_text_field :name, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :provider, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_text_field :course_length, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :year_awarded, label: { size: "s" }, type: "number", width: 4, hint: { text: t(".hint") }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_submit t("buttons.save_and_continue")

.govuk-button-group
Expand Down
11 changes: 10 additions & 1 deletion app/views/jobseekers/profiles/training_and_cpds/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
h1.govuk-heading-xl = "Add training and continuing professional development (CPD)"

= form_for form, url: jobseekers_profile_training_and_cpds_path(profile), method: :post do |f|
p.govuk-body = t(".description")
p.govuk-body = t(".example_intro")
ul.govuk-list.govuk-list--bullet
li = t(".example1")
li = t(".example2")
li = t(".example3")
li = t(".example4")

= f.govuk_error_summary

= f.govuk_text_field :name, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :provider, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_text_field :course_length, label: { size: "s" }, aria: { required: true }
= f.govuk_text_field :year_awarded, label: { size: "s" }, type: "number", width: 4, hint: { text: t(".hint") }
= f.govuk_text_field :grade, label: { size: "s" }
= f.govuk_submit t("buttons.save_and_continue")

.govuk-button-group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.provider")
- row.with_value text: training.provider

- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.grade")
- row.with_value text: training.grade
- if training.course_length.present?
- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.course_length")
- row.with_value text: training.course_length

- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.year_awarded")
- row.with_value text: training.year_awarded

- summary_list.with_row do |row|
- row.with_key text: t("helpers.label.jobseekers_training_and_cpd_form.grade")
- row.with_value text: training.grade

- detail.with_action govuk_link_to(safe_join([t("buttons.change"), tag.span(training.name, class: "govuk-visually-hidden")]), edit_jobseekers_profile_training_and_cpd_path(training), class: "govuk-link--no-visited-state")
- detail.with_action govuk_link_to(safe_join([t("buttons.delete"), tag.span(training.name, class: "govuk-visually-hidden")]), jobseekers_profile_training_and_cpd_confirm_destroy_path(training))
1 change: 1 addition & 0 deletions config/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ shared:
- updated_at
- jobseeker_profile_id
- job_application_id
- course_length
:noticed_notifications:
- id
- type
Expand Down
2 changes: 2 additions & 0 deletions config/locales/activerecord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,8 @@ en:
blank: Enter the name of the provider of the training
year_awarded:
blank: Enter the year the course or training was awarded
course_length:
blank: Enter the length of the course
jobseekers/account_transfer_form:
attributes:
email:
Expand Down
3 changes: 2 additions & 1 deletion config/locales/forms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,9 @@ en:
name: Name of course or training
provider: Training provider
grade: Grade (optional)
year_awarded: Year awarded
year_awarded: Date completed
year_completed_hint: For example, 1998
course_length: Course length


personal_details_form:
Expand Down
23 changes: 19 additions & 4 deletions config/locales/jobseekers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ en:
success: Thank you for your feedback on your job alert
update:
success: Thank you for providing additional feedback on your job alert
shared:
training_shared: &training_shared
example_intro: "For example you could include:"
example1: safeguarding training
example2: Prevent duty training
example3: first aid courses
example4: Team Teach
job_applications:
apply: Apply for this job
applying_for_the_job_heading: Applying for the job
Expand Down Expand Up @@ -251,13 +258,17 @@ en:
step_title: Training and continuing professional development (CPD)
title: Add training and continuing professional development (CPD)
new:
hint: For example, 1998
<<: *training_shared
hint: For example, 2024.
caption: Training and continuing professional development (CPD)
heading: Add training and continuing professional development (CPD)
description: Include any training you've completed within the last 3 years relevant to the role you're applying for.
edit:
hint: For example, 1998
<<: *training_shared
hint: For example, 2024.
caption: Training and continuing professional development (CPD)
heading: Edit training and continuing professional development (CPD)
description: Include any training you've completed within the last 3 years relevant to the role you're applying for.
destroy:
success: Training deleted
review:
Expand Down Expand Up @@ -767,9 +778,13 @@ en:
about_you_title: About You
training_and_cpds:
new:
hint: For example, 1998
<<: *training_shared
hint: For example, 2024.
description: Include any training you've completed within the last 3 years.
edit:
hint: For example, 1998
<<: *training_shared
hint: For example, 2024.
description: Include any training you've completed within the last 3 years.
destroy:
success: Training deleted
qualifications:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCourseLengthToTrainingAndCpds < ActiveRecord::Migration[7.2]
def change
add_column :training_and_cpds, :course_length, :string
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@
t.datetime "updated_at", null: false
t.uuid "jobseeker_profile_id"
t.uuid "job_application_id"
t.string "course_length"
t.index ["job_application_id"], name: "index_training_and_cpds_on_job_application_id"
t.index ["jobseeker_profile_id"], name: "index_training_and_cpds_on_jobseeker_profile_id"
end
Expand Down
1 change: 1 addition & 0 deletions spec/factories/training_and_cpds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
provider { "TeachTrainLtd" }
grade { "Pass" }
year_awarded { "2020" }
course_length { "1 year" }

jobseeker_profile { nil }
job_application { nil }
Expand Down
1 change: 1 addition & 0 deletions spec/form_models/jobseekers/training_and_cpd_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:provider) }
it { is_expected.to validate_presence_of(:year_awarded) }
it { is_expected.to validate_presence_of(:course_length) }
end
5 changes: 3 additions & 2 deletions spec/support/jobseeker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ def fill_in_employment_history(job_title: "The Best Teacher", start_month: "09",
fill_in "jobseekers_job_application_details_employment_form[ended_on(2i)]", with: end_month
end

def fill_in_training_and_cpds(name: "Fire safety", provider: "TrainingProvider ltd", grade: "Pass", year_awarded: "2020")
def fill_in_training_and_cpds(name: "Fire safety", provider: "TrainingProvider ltd", grade: "Pass", year_awarded: "2020", course_length: "1 year")
fill_in "Name of course or training", with: name
fill_in "Training provider", with: provider
fill_in "Grade", with: grade
fill_in "Year awarded", with: year_awarded
fill_in "Date completed", with: year_awarded
fill_in "Course length", with: course_length
end

def fill_in_break_in_employment(start_year: "2020", start_month: "08", end_year: "2020", end_month: "12")
Expand Down
Loading

0 comments on commit d817f6b

Please sign in to comment.