-
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 branch 'master' into postcode-search-form
- Loading branch information
Showing
20 changed files
with
187 additions
and
160 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
44 changes: 44 additions & 0 deletions
44
app/forms/journeys/teacher_student_loan_reimbursement/still_teaching_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,44 @@ | ||
module Journeys | ||
module TeacherStudentLoanReimbursement | ||
class StillTeachingForm < Form | ||
attribute :employment_status | ||
attribute :current_school_id | ||
|
||
validates :employment_status, presence: {message: ->(form, _) { form.error_message }} | ||
|
||
def save | ||
return false unless valid? | ||
|
||
update!( | ||
eligibility_attributes: { | ||
employment_status:, | ||
current_school_id: currently_at_school? ? current_school_id : nil | ||
} | ||
) | ||
end | ||
|
||
def school | ||
claim.logged_in_with_tid_and_has_recent_tps_school? ? claim.recent_tps_school : claim.eligibility.claim_school | ||
end | ||
|
||
def error_message | ||
if school.open? | ||
i18n_errors_path("select_which_school_currently", school_name: school.name) | ||
else | ||
i18n_errors_path("select_are_you_still_employed") | ||
end | ||
end | ||
|
||
# Helper used in the view to choose partials and locale keys | ||
def tps_or_claim_school | ||
claim.logged_in_with_tid_and_has_recent_tps_school? ? "tps_school" : "claim_school" | ||
end | ||
|
||
private | ||
|
||
def currently_at_school? | ||
%w[claim_school recent_tps_school].include?(employment_status) | ||
end | ||
end | ||
end | ||
end |
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
20 changes: 10 additions & 10 deletions
20
app/views/student_loans/claims/_still_teaching_with_claim_school.html.erb
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,23 +1,23 @@ | ||
<% if claim_school.open? %> | ||
<%= fields.hidden_field :current_school_id, value: claim_school.id %> | ||
<% if school.open? %> | ||
<%= form.hidden_field :current_school_id, value: school.id %> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :claim_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_claim_school, "Yes, at #{claim_school.name}", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :claim_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_claim_school, "Yes, at #{school.name}", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :different_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_different_school, "Yes, at another school", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :different_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_different_school, "Yes, at another school", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
<% else %> | ||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :different_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_different_school, "Yes", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :different_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_different_school, "Yes", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
<% end %> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :no_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_no_school, "No", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :no_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_no_school, "No", class: "govuk-label govuk-radios__label" %> | ||
</div> |
16 changes: 8 additions & 8 deletions
16
app/views/student_loans/claims/_still_teaching_with_tps_school.html.erb
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,21 +1,21 @@ | ||
<%= fields.hidden_field :current_school_id, value: current_school.id %> | ||
<%= form.hidden_field :current_school_id, value: school.id %> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :recent_tps_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_recent_tps_school, "Yes, at #{current_school.name}", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :recent_tps_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_recent_tps_school, "Yes, at #{school.name}", class: "govuk-label govuk-radios__label" %> | ||
<div id="school-checker-item-hint" class="govuk-hint govuk-radios__hint"> | ||
<%= current_school.address %> | ||
<%= school.address %> | ||
</div> | ||
</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :different_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_different_school, "Somewhere else", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :different_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_different_school, "Somewhere else", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
|
||
<div class="govuk-radios__divider">or</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= fields.radio_button(:employment_status, :no_school, class: "govuk-radios__input") %> | ||
<%= fields.label :employment_status_no_school, "I'm no longer employed to teach at a state-funded secondary school in England", class: "govuk-label govuk-radios__label" %> | ||
<%= form.radio_button(:employment_status, :no_school, class: "govuk-radios__input") %> | ||
<%= form.label :employment_status_no_school, "I'm no longer employed to teach at a state-funded secondary school in England", class: "govuk-label govuk-radios__label" %> | ||
</div> |
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
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.