-
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.
faith schools: Convert religious forms to single step with 'complete …
…later' field (#7435)
- Loading branch information
Showing
41 changed files
with
367 additions
and
451 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[CatholicForm], 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
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
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.
36 changes: 36 additions & 0 deletions
36
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,36 @@ | ||
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) | ||
model.slice(*storable_fields).merge(completed_attrs(model, :catholic)) | ||
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.
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
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) | ||
super.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
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
Oops, something went wrong.