-
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 pull request #2939 from DFE-Digital/fe-poor-performance
[LUPEYALPHA-555] Add poor performance form to FE journey
- Loading branch information
Showing
25 changed files
with
339 additions
and
232 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
app/forms/journeys/additional_payments_for_teaching/poor_performance_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class PoorPerformanceForm < Form | ||
attribute :subject_to_formal_performance_action, :boolean | ||
attribute :subject_to_disciplinary_action, :boolean | ||
|
||
validates :subject_to_formal_performance_action, | ||
inclusion: { | ||
in: [true, false], | ||
message: i18n_error_message("performance.inclusion") | ||
} | ||
|
||
validates :subject_to_disciplinary_action, | ||
inclusion: { | ||
in: [true, false], | ||
message: i18n_error_message("disciplinary.inclusion") | ||
} | ||
|
||
def radio_options | ||
[ | ||
OpenStruct.new( | ||
id: true, | ||
name: "Yes" | ||
), | ||
OpenStruct.new( | ||
id: false, | ||
name: "No" | ||
) | ||
] | ||
end | ||
|
||
def save | ||
return false if invalid? | ||
|
||
journey_session.answers.assign_attributes( | ||
subject_to_formal_performance_action:, | ||
subject_to_disciplinary_action: | ||
) | ||
journey_session.save | ||
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
102 changes: 22 additions & 80 deletions
102
app/views/additional_payments/claims/poor_performance.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,89 +1,31 @@ | ||
<% content_for(:page_title, page_title(t("#{@form.i18n_namespace}.forms.poor_performance.questions.poor_performance"), journey: current_journey_routing_name, show_error: @form.errors.any?)) %> | ||
<% content_for(:page_title, page_title(@form.t(:heading), journey: current_journey_routing_name, show_error: @form.errors.any?)) %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= render("shared/error_summary", instance: @form, errored_field_id_overrides: { | ||
"subject_to_formal_performance_action": "claim_subject_to_formal_performance_action_true", | ||
"subject_to_disciplinary_action": "claim_subject_to_disciplinary_action_true" | ||
}) if @form.errors.any? %> | ||
<%= form_for @form, url: claim_path(current_journey_routing_name) do |form| %> | ||
<%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> | ||
<%= f.govuk_error_summary %> | ||
|
||
<h1 class="govuk-heading-l"> | ||
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.poor_performance") %> | ||
<%= @form.t(:heading) %> | ||
</h1> | ||
<%= form_group_tag @form, :subject_to_formal_performance_action do %> | ||
|
||
<%= form.hidden_field :subject_to_formal_performance_action %> | ||
|
||
<fieldset class="govuk-fieldset" aria-describedby="formal_performance_action-hint"> | ||
|
||
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m"> | ||
<h2 class="govuk-fieldset__heading"> | ||
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.formal_performance_action") %> | ||
</h2> | ||
</legend> | ||
|
||
<%= errors_tag @form, :subject_to_formal_performance_action %> | ||
|
||
<div id="formal_performance_action-hint" class="govuk-hint"> | ||
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.formal_performance_action_hint") %> | ||
</div> | ||
|
||
<div class="govuk-radios"> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= form.radio_button(:subject_to_formal_performance_action, true, class: "govuk-radios__input") %> | ||
<%= form.label :subject_to_formal_performance_action_true, "Yes", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= form.radio_button(:subject_to_formal_performance_action, false, class: "govuk-radios__input") %> | ||
<%= form.label :subject_to_formal_performance_action_false, "No", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
|
||
</div> | ||
|
||
</fieldset> | ||
|
||
<% end %> | ||
|
||
<%= form_group_tag @form, :subject_to_disciplinary_action do %> | ||
|
||
<%= form.hidden_field :subject_to_disciplinary_action %> | ||
|
||
<fieldset class="govuk-fieldset" aria-describedby="disciplinary_action-hint"> | ||
|
||
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m"> | ||
<h2 class="govuk-fieldset__heading"> | ||
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.disciplinary_action") %> | ||
</h2> | ||
</legend> | ||
|
||
<%= errors_tag @form, :subject_to_disciplinary_action %> | ||
|
||
<div id="disciplinary_action-hint" class="govuk-hint"> | ||
<%= t("#{@form.i18n_namespace}.forms.poor_performance.questions.disciplinary_action_hint") %> | ||
</div> | ||
|
||
<div class="govuk-radios"> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= form.radio_button(:subject_to_disciplinary_action, true, class: "govuk-radios__input") %> | ||
<%= form.label :subject_to_disciplinary_action_true, "Yes", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
|
||
<div class="govuk-radios__item"> | ||
<%= form.radio_button(:subject_to_disciplinary_action, false, class: "govuk-radios__input") %> | ||
<%= form.label :subject_to_disciplinary_action_false, "No", class: "govuk-label govuk-radios__label" %> | ||
</div> | ||
|
||
</div> | ||
|
||
</fieldset> | ||
|
||
<% end %> | ||
|
||
|
||
<%= form.submit "Continue", class: "govuk-button", data: {module: "govuk-button"} %> | ||
<%= f.govuk_collection_radio_buttons :subject_to_formal_performance_action, @form.radio_options, :id, :name, | ||
legend: { | ||
text: @form.t("questions.performance.question"), | ||
tag: "h2", | ||
size: "m" | ||
}, | ||
hint: { text: @form.t("questions.performance.hint") } %> | ||
|
||
<%= f.govuk_collection_radio_buttons :subject_to_disciplinary_action, @form.radio_options, :id, :name, | ||
legend: { | ||
text: @form.t("questions.disciplinary.question"), | ||
tag: "h2", | ||
size: "m" | ||
}, | ||
hint: { text: @form.t("questions.disciplinary.hint") } %> | ||
|
||
<%= f.govuk_submit %> | ||
<% end %> | ||
</div> | ||
</div> |
34 changes: 28 additions & 6 deletions
34
app/views/further_education_payments/claims/poor_performance.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,7 +1,29 @@ | ||
<p class="govuk-body"> | ||
FE poor performance goes here | ||
</p> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> | ||
<%= f.govuk_error_summary %> | ||
|
||
<%= form_with model: @form, url: claim_path(current_journey_routing_name), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %> | ||
<%= f.govuk_submit %> | ||
<% end %> | ||
<h1 class="govuk-heading-l"> | ||
<%= @form.t(:heading) %> | ||
</h1> | ||
|
||
<%= f.govuk_collection_radio_buttons :subject_to_formal_performance_action, @form.radio_options, :id, :name, | ||
legend: { | ||
text: @form.t("questions.performance.question"), | ||
tag: "h2", | ||
size: "m" | ||
}, | ||
hint: { text: @form.t("questions.performance.hint") } %> | ||
|
||
<%= f.govuk_collection_radio_buttons :subject_to_disciplinary_action, @form.radio_options, :id, :name, | ||
legend: { | ||
text: @form.t("questions.disciplinary.question"), | ||
tag: "h2", | ||
size: "m" | ||
}, | ||
hint: { text: @form.t("questions.disciplinary.hint") } %> | ||
|
||
<%= f.govuk_submit %> | ||
<% end %> | ||
</div> | ||
</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
Oops, something went wrong.