-
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.
Convert religious forms to single step with 'complete later' field to…
… match other task list steps
- Loading branch information
Showing
28 changed files
with
365 additions
and
382 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
8 changes: 1 addition & 7 deletions
8
app/components/job_application_review_component/catholic_religious_information_section.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,11 +1,5 @@ | ||
class JobApplicationReviewComponent::CatholicReligiousInformationSection < JobApplicationReviewComponent::Section | ||
def initialize(job_application, allow_edit:, name:) | ||
# only include the details form if we follow a religion | ||
forms = if job_application.following_religion | ||
%w[CatholicFollowingReligionForm CatholicReligionDetailsForm] | ||
else | ||
%w[CatholicFollowingReligionForm] | ||
end | ||
super(job_application, forms: forms, name: name, allow_edit: allow_edit) | ||
super(job_application, forms: %w[ReligiousInformationForm], name: name, allow_edit: allow_edit) | ||
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
4 changes: 0 additions & 4 deletions
4
app/form_models/jobseekers/job_application/catholic_following_religion_form.rb
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
app/form_models/jobseekers/job_application/catholic_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,37 @@ | ||
module Jobseekers | ||
module JobApplication | ||
class CatholicForm < ReligiousInformationForm | ||
FIELDS = %i[baptism_certificate | ||
baptism_address].freeze | ||
|
||
class << self | ||
def storable_fields | ||
super + FIELDS + [:baptism_date] | ||
end | ||
|
||
def unstorable_fields | ||
%i[catholic_section_completed] | ||
end | ||
|
||
def load_form(model) | ||
# baptism_certificate is an upload so is not an attribute | ||
load_form_attributes(model.attributes.merge(completed_attrs(model, :catholic)).merge(baptism_certificate: model.baptism_certificate)) | ||
end | ||
end | ||
|
||
attr_accessor(*FIELDS) | ||
|
||
attribute :baptism_date, :date | ||
|
||
validates :religious_reference_type, | ||
inclusion: { in: ::JobApplication::RELIGIOUS_REFERENCE_TYPES.keys.map(&:to_s), nil: false }, | ||
if: -> { catholic_section_completed && following_religion } | ||
|
||
completed_attribute(:catholic) | ||
|
||
def section_completed | ||
catholic_section_completed | ||
end | ||
end | ||
end | ||
end |
43 changes: 0 additions & 43 deletions
43
app/form_models/jobseekers/job_application/catholic_religion_details_form.rb
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
app/form_models/jobseekers/job_application/following_religion_form.rb
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
app/form_models/jobseekers/job_application/non_catholic_following_religion_form.rb
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
app/form_models/jobseekers/job_application/non_catholic_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,31 @@ | ||
module Jobseekers | ||
module JobApplication | ||
class NonCatholicForm < ReligiousInformationForm | ||
class << self | ||
def storable_fields | ||
super + [:ethos_and_aims] | ||
end | ||
|
||
def unstorable_fields | ||
%i[non_catholic_section_completed] | ||
end | ||
|
||
def load_form(model) | ||
load_form_attributes(model.attributes.merge(completed_attrs(model, :non_catholic))) | ||
end | ||
end | ||
|
||
attr_accessor(:ethos_and_aims) | ||
|
||
validates_presence_of :ethos_and_aims | ||
|
||
validates :religious_reference_type, inclusion: { in: %w[referee no_referee], nil: false }, if: -> { non_catholic_section_completed && following_religion } | ||
|
||
completed_attribute(:non_catholic) | ||
|
||
def section_completed | ||
non_catholic_section_completed | ||
end | ||
end | ||
end | ||
end |
25 changes: 0 additions & 25 deletions
25
app/form_models/jobseekers/job_application/non_catholic_religion_details_form.rb
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
43 changes: 43 additions & 0 deletions
43
app/form_models/jobseekers/job_application/religious_information_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,43 @@ | ||
module Jobseekers | ||
module JobApplication | ||
class ReligiousInformationForm < BaseForm | ||
include ActiveRecord::AttributeAssignment | ||
include ActiveModel::Attributes | ||
include CompletedFormAttribute | ||
|
||
FIELDS = %i[faith | ||
place_of_worship | ||
religious_reference_type | ||
religious_referee_name | ||
religious_referee_address | ||
religious_referee_role | ||
religious_referee_email | ||
religious_referee_phone].freeze | ||
|
||
STORABLE_FIELDS = (FIELDS + %i[following_religion]).freeze | ||
|
||
class << self | ||
def storable_fields | ||
STORABLE_FIELDS | ||
end | ||
end | ||
|
||
attr_accessor(*FIELDS) | ||
|
||
attribute :following_religion, :boolean | ||
|
||
validates :following_religion, inclusion: { in: [true, false], allow_nil: false }, if: -> { section_completed } | ||
|
||
validates :faith, presence: true, if: -> { section_completed && following_religion } | ||
|
||
validates :religious_referee_name, :religious_referee_address, :religious_referee_role, :religious_referee_email, | ||
presence: true, if: -> { section_completed && following_religion && religious_reference_type == "referee" } | ||
validates :religious_referee_email, email: true, if: -> { section_completed && following_religion && religious_reference_type == "referee" } | ||
|
||
validates :baptism_address, :baptism_date, | ||
presence: true, if: -> { section_completed && following_religion && religious_reference_type == "baptism_date" } | ||
|
||
validates :baptism_certificate, form_file: DOCUMENT_VALIDATION_OPTIONS, presence: true, if: -> { section_completed && following_religion && religious_reference_type == "baptism_certificate" } | ||
end | ||
end | ||
end |
14 changes: 0 additions & 14 deletions
14
app/form_models/jobseekers/job_application/school_ethos_form.rb
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
Oops, something went wrong.