-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2978 from DFE-Digital/fe-subjects-branching
[LUPEYALPHA-551] FE subjects and courses
- Loading branch information
Showing
38 changed files
with
1,340 additions
and
50 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
app/forms/journeys/further_education_payments/building_construction_courses_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class BuildingConstructionCoursesForm < Form | ||
include ActionView::Helpers::UrlHelper | ||
include ActionView::Helpers::OutputSafetyHelper | ||
include GovukVisuallyHiddenHelper | ||
include GovukLinkHelper | ||
|
||
attribute :building_construction_courses, default: [] | ||
|
||
before_validation :clean_courses | ||
|
||
validates :building_construction_courses, | ||
presence: {message: i18n_error_message(:inclusion)}, | ||
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def course_field | ||
:building_construction_courses | ||
end | ||
|
||
def checkbox_options | ||
[ | ||
OpenStruct.new( | ||
id: "esfa_buildingconstruction", | ||
name: t( | ||
"options.esfa_buildingconstruction", | ||
link: govuk_link_to("building and construction", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=7", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_building", | ||
name: t("options.tlevel_building") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_onsiteconstruction", | ||
name: t("options.tlevel_onsiteconstruction") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_design_surveying", | ||
name: t("options.tlevel_design_surveying") | ||
), | ||
OpenStruct.new( | ||
id: "level2_3_apprenticeship", | ||
name: t( | ||
"options.level2_3_apprenticeship", | ||
link: govuk_link_to("construction and the built environment occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/construction", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "none", | ||
name: t("options.none") | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(building_construction_courses:) | ||
journey_session.save! | ||
end | ||
|
||
private | ||
|
||
def clean_courses | ||
building_construction_courses.reject!(&:blank?) | ||
end | ||
end | ||
end | ||
end |
56 changes: 56 additions & 0 deletions
56
app/forms/journeys/further_education_payments/chemistry_courses_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class ChemistryCoursesForm < Form | ||
include ActionView::Helpers::UrlHelper | ||
include ActionView::Helpers::OutputSafetyHelper | ||
include GovukVisuallyHiddenHelper | ||
include GovukLinkHelper | ||
|
||
attribute :chemistry_courses, default: [] | ||
|
||
before_validation :clean_courses | ||
|
||
validates :chemistry_courses, | ||
presence: {message: i18n_error_message(:inclusion)}, | ||
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def course_field | ||
:chemistry_courses | ||
end | ||
|
||
def checkbox_options | ||
[ | ||
OpenStruct.new( | ||
id: "alevel_chemistry", | ||
name: t("options.alevel_chemistry") | ||
), | ||
OpenStruct.new( | ||
id: "gcse_chemistry", | ||
name: t("options.gcse_chemistry") | ||
), | ||
OpenStruct.new( | ||
id: "ib_certificate_chemistry", | ||
name: t("options.ib_certificate_chemistry") | ||
), | ||
OpenStruct.new( | ||
id: "none", | ||
name: t("options.none") | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(chemistry_courses:) | ||
journey_session.save! | ||
end | ||
|
||
private | ||
|
||
def clean_courses | ||
chemistry_courses.reject!(&:blank?) | ||
end | ||
end | ||
end | ||
end |
85 changes: 85 additions & 0 deletions
85
app/forms/journeys/further_education_payments/computing_courses_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class ComputingCoursesForm < Form | ||
include ActionView::Helpers::UrlHelper | ||
include ActionView::Helpers::OutputSafetyHelper | ||
include GovukVisuallyHiddenHelper | ||
include GovukLinkHelper | ||
|
||
attribute :computing_courses, default: [] | ||
|
||
before_validation :clean_courses | ||
|
||
validates :computing_courses, | ||
presence: {message: i18n_error_message(:inclusion)}, | ||
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def course_field | ||
:computing_courses | ||
end | ||
|
||
def checkbox_options | ||
[ | ||
OpenStruct.new( | ||
id: "esfa_digitalpractitioners", | ||
name: t( | ||
"options.esfa_digitalpractitioners", | ||
link: govuk_link_to("digital technology for practitioners", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=23&PageSize=10&Sort=Status", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "esfa_digitalusers", | ||
name: t( | ||
"options.esfa_digitalusers", | ||
link: govuk_link_to("digital technology for users", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=22&PageSize=10&Sort=Status", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "digitalskills_quals", | ||
name: t("options.digitalskills_quals") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_digitalsupport", | ||
name: t("options.tlevel_digitalsupport") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_digitalbusiness", | ||
name: t("options.tlevel_digitalbusiness") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_digitalproduction", | ||
name: t("options.tlevel_digitalproduction") | ||
), | ||
OpenStruct.new( | ||
id: "ib_certificate_compsci", | ||
name: t("options.ib_certificate_compsci") | ||
), | ||
OpenStruct.new( | ||
id: "level2_3_apprenticeship", | ||
name: t( | ||
"options.level2_3_apprenticeship", | ||
link: govuk_link_to("digital occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/digital", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "none", | ||
name: t("options.none") | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(computing_courses:) | ||
journey_session.save! | ||
end | ||
|
||
private | ||
|
||
def clean_courses | ||
computing_courses.reject!(&:blank?) | ||
end | ||
end | ||
end | ||
end |
63 changes: 63 additions & 0 deletions
63
app/forms/journeys/further_education_payments/early_years_courses_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class EarlyYearsCoursesForm < Form | ||
include ActionView::Helpers::UrlHelper | ||
include ActionView::Helpers::OutputSafetyHelper | ||
include GovukVisuallyHiddenHelper | ||
include GovukLinkHelper | ||
|
||
attribute :early_years_courses, default: [] | ||
|
||
before_validation :clean_courses | ||
|
||
validates :early_years_courses, | ||
presence: {message: i18n_error_message(:inclusion)}, | ||
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def course_field | ||
:early_years_courses | ||
end | ||
|
||
def checkbox_options | ||
[ | ||
OpenStruct.new( | ||
id: "eylevel2", | ||
name: t("options.eylevel2") | ||
), | ||
OpenStruct.new( | ||
id: "eylevel3", | ||
name: t("options.eylevel3") | ||
), | ||
OpenStruct.new( | ||
id: "eytlevel", | ||
name: t("options.eytlevel") | ||
), | ||
OpenStruct.new( | ||
id: "coursetoeyq", | ||
name: t( | ||
"options.coursetoeyq", | ||
link: govuk_link_to("early years qualification", "https://www.gov.uk/government/publications/early-years-qualifications-achieved-in-england", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "none", | ||
name: t("options.none") | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(early_years_courses:) | ||
journey_session.save! | ||
end | ||
|
||
private | ||
|
||
def clean_courses | ||
early_years_courses.reject!(&:blank?) | ||
end | ||
end | ||
end | ||
end |
84 changes: 84 additions & 0 deletions
84
app/forms/journeys/further_education_payments/engineering_manufacturing_courses_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
module Journeys | ||
module FurtherEducationPayments | ||
class EngineeringManufacturingCoursesForm < Form | ||
include ActionView::Helpers::UrlHelper | ||
include ActionView::Helpers::OutputSafetyHelper | ||
include GovukVisuallyHiddenHelper | ||
include GovukLinkHelper | ||
|
||
attribute :engineering_manufacturing_courses, default: [] | ||
|
||
before_validation :clean_courses | ||
|
||
validates :engineering_manufacturing_courses, | ||
presence: {message: i18n_error_message(:inclusion)}, | ||
inclusion: {in: ->(form) { form.checkbox_options.map(&:id) }, message: i18n_error_message(:inclusion)} | ||
|
||
def course_field | ||
:engineering_manufacturing_courses | ||
end | ||
|
||
def checkbox_options | ||
[ | ||
OpenStruct.new( | ||
id: "esfa_engineering", | ||
name: t( | ||
"options.esfa_engineering", | ||
link: govuk_link_to("engineering", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=13&PageSize=10&Sort=Status", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "esfa_manufacturing", | ||
name: t( | ||
"options.esfa_manufacturing", | ||
link: govuk_link_to("manufacturing technologies", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=26&PageSize=10&Sort=Status", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "esfa_transportation", | ||
name: t( | ||
"options.esfa_transportation", | ||
link: govuk_link_to("transportation operations and maintenance", "https://www.qualifications.education.gov.uk/Search?Status=Approved&Level=0,1,2,3,4&Sub=47&PageSize=10&Sort=Status", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_design", | ||
name: t("options.tlevel_design") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_maintenance", | ||
name: t("options.tlevel_maintenance") | ||
), | ||
OpenStruct.new( | ||
id: "tlevel_engineering", | ||
name: t("options.tlevel_engineering") | ||
), | ||
OpenStruct.new( | ||
id: "level2_3_apprenticeship", | ||
name: t( | ||
"options.level2_3_apprenticeship", | ||
link: govuk_link_to("engineering and manufacturing occupational route", "https://occupational-maps.instituteforapprenticeships.org/maps/route/engineering-manufacturing", new_tab: true) | ||
) | ||
), | ||
OpenStruct.new( | ||
id: "none", | ||
name: t("options.none") | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes(engineering_manufacturing_courses:) | ||
journey_session.save! | ||
end | ||
|
||
private | ||
|
||
def clean_courses | ||
engineering_manufacturing_courses.reject!(&:blank?) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.