-
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.
use pre-submit form to check for all sections being completed in both…
… apply and review steps
- Loading branch information
Showing
6 changed files
with
58 additions
and
43 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
26 changes: 26 additions & 0 deletions
26
app/form_models/jobseekers/job_application/pre_submit_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,26 @@ | ||
# frozen_string_literal: true | ||
|
||
module Jobseekers | ||
module JobApplication | ||
class PreSubmitForm | ||
include ActiveModel::Model | ||
|
||
attr_accessor :completed_steps, :all_steps | ||
|
||
validate :all_steps_completed? | ||
|
||
def all_steps_completed? | ||
all_steps.each do |step| | ||
next if step.in?(completed_steps) | ||
|
||
errors.add( | ||
:base, | ||
# I18n.t("activemodel.errors.models.jobseekers/job_application/review_form.attributes.#{step}.incomplete"), | ||
"#{step}.incomplete".to_sym, | ||
) | ||
end | ||
end | ||
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