-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
175 additions
and
176 deletions.
There are no files selected for viewing
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
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
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
36 changes: 25 additions & 11 deletions
36
app/form_models/publishers/job_listing/applying_for_the_job_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 |
---|---|---|
@@ -1,20 +1,34 @@ | ||
class Publishers::JobListing::ApplyingForTheJobForm < Publishers::JobListing::VacancyForm | ||
before_validation :override_enable_job_applications! | ||
|
||
validates :enable_job_applications, inclusion: { in: [true, false, "true", "false"] } | ||
validates :application_form_type, presence: true | ||
|
||
def self.fields | ||
%i[enable_job_applications] | ||
%i[application_form_type] | ||
end | ||
attr_accessor(*fields) | ||
|
||
private | ||
class << self | ||
def load_form(model) | ||
if model.enable_job_applications | ||
{ application_form_type: model.religion_type || "no_religion" } | ||
elsif model.enable_job_applications == false | ||
{ application_form_type: "other" } | ||
else | ||
{} | ||
end | ||
end | ||
end | ||
|
||
def override_enable_job_applications! | ||
# If a Publisher publishes a vacancy for a job role that does not allow enabling job applications | ||
# but then changes the job role to one that does, enable_job_applications is nil, meaning the validation | ||
# for this field does not pass. We want the validations for the enable_job_applications field to pass | ||
# to prevent an error from being displayed on the review page in this situation when validate_all_steps is run. | ||
self.enable_job_applications = false if vacancy&.listed? && enable_job_applications.blank? | ||
def params_to_save | ||
if application_form_type == "other" | ||
{ | ||
religion_type: nil, | ||
enable_job_applications: false, | ||
} | ||
else | ||
{ | ||
religion_type: application_form_type, | ||
enable_job_applications: true, | ||
} | ||
end | ||
end | ||
end |
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
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
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
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
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
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
53 changes: 33 additions & 20 deletions
53
app/views/publishers/vacancies/build/applying_for_the_job.html.slim
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 |
---|---|---|
@@ -1,29 +1,42 @@ | ||
- content_for :page_title_prefix, page_title_prefix(step_process, form) | ||
|
||
.govuk-grid-row | ||
.govuk-grid-column-two-thirds | ||
= form_for form, url: wizard_path(current_step), method: :patch do |f| | ||
= f.govuk_error_summary | ||
= form_for form, url: wizard_path(current_step), method: :patch do |f| | ||
= f.govuk_error_summary | ||
|
||
= vacancy_form_page_heading(vacancy, step_process, back_path: back_path, fieldset: false) | ||
= vacancy_form_page_heading(vacancy, step_process, back_path: back_path, fieldset: false) | ||
|
||
p.govuk-body = t(".using_application_form_html", link: govuk_link_to(t(".kcsie_guidance"), t(".kcsie_url"), target: "_blank", rel: "noreferrer noopener")) | ||
- if vacancy.listed? | ||
= f.hidden_field :application_form_type, :other | ||
- else | ||
= f.govuk_radio_buttons_fieldset :application_form_type, legend: nil do | ||
p.govuk-body = t(".using_application_form") | ||
|
||
p.govuk-body = t(".reason_for_our_form") | ||
p.govuk-body = t(".reason_for_our_form") | ||
|
||
= govuk_details(summary_text: "See what an application form looks like") do | ||
= job_application_review(job_application_sample(vacancy), step_process: {}, show_tracks: false, show_sidebar: false, allow_edit: false) do |r| | ||
- render "jobseekers/job_applications/job_application_review_sections", r: r, job_application: r.job_application | ||
= f.govuk_radio_button :application_form_type, :no_religion, | ||
label: -> { t("helpers.label.publishers_job_listing_applying_for_the_job_form.application_form_type_options.no_religion_html", tag: govuk_tag(text: t(".kcsie_compliant"), colour: "green")) }, | ||
link_errors: true | ||
= govuk_details(summary_text: t(".preview_online_application_form")) do | ||
= job_application_review(job_application_sample(vacancy), step_process: {}, show_tracks: false, show_sidebar: false, allow_edit: false) do |r| | ||
- render "jobseekers/job_applications/job_application_review_sections", r: r, job_application: r.job_application | ||
|
||
- if vacancy.listed? | ||
= f.hidden_field :enable_job_applications | ||
- else | ||
= f.govuk_radio_buttons_fieldset :enable_job_applications, legend: { size: "m", tag: nil } do | ||
= f.govuk_radio_button :enable_job_applications, true, | ||
label: -> { safe_join([t("helpers.label.publishers_job_listing_applying_for_the_job_form.enable_job_applications_options.true"), govuk_tag(text: t(".kcsie_compliant"), colour: "green")]) }, | ||
hint: { text: vacancy.organisations.any?(&:faith_school?) ? t(".ask_about_religion") : t(".this_form_is_kept_up_to_date") }, | ||
link_errors: true | ||
= f.govuk_radio_divider | ||
= f.govuk_radio_button :enable_job_applications, "false" | ||
- if vacancy.organisations.any?(&:faith_school?) | ||
= f.govuk_radio_button :application_form_type, :other_religion, | ||
label: -> { t("helpers.label.publishers_job_listing_applying_for_the_job_form.application_form_type_options.other_religion_html", tag: govuk_tag(text: t(".kcsie_compliant"), colour: "green")) } | ||
|
||
= render "publishers/vacancies/vacancy_form_partials/submit", f: f | ||
= govuk_details(summary_text: t(".preview_religious_application_form")) do | ||
= job_application_review(religious_job_application_sample(vacancy), step_process: {}, show_tracks: false, show_sidebar: false, allow_edit: false) do |r| | ||
- render "jobseekers/job_applications/job_application_review_sections", r: r, job_application: r.job_application | ||
|
||
= f.govuk_radio_button :application_form_type, :catholic, | ||
label: -> { t("helpers.label.publishers_job_listing_applying_for_the_job_form.application_form_type_options.catholic_html", tag: govuk_tag(text: t(".kcsie_compliant"), colour: "green")) } | ||
= govuk_details(summary_text: t(".preview_catholic_application_form")) do | ||
= job_application_review(catholic_job_application_sample(vacancy), step_process: {}, show_tracks: false, show_sidebar: false, allow_edit: false) do |r| | ||
- render "jobseekers/job_applications/job_application_review_sections", r: r, job_application: r.job_application | ||
|
||
= f.govuk_radio_divider | ||
|
||
= f.govuk_radio_button :application_form_type, :other | ||
|
||
= render "publishers/vacancies/vacancy_form_partials/submit", f: f |
17 changes: 0 additions & 17 deletions
17
app/views/publishers/vacancies/build/religious_information.html.slim
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.