-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP-5531: Add appeal court type quesion 3 and 4
Add the controllers, forms, views and steps to complete the ECCT question flow as per the designs.
- Loading branch information
Showing
33 changed files
with
958 additions
and
62 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
app/controllers/providers/application_merits_task/base_appeal_court_types_controller.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,35 @@ | ||
module Providers | ||
module ApplicationMeritsTask | ||
class BaseAppealCourtTypesController < ProviderBaseController | ||
def show | ||
@form = form.new(model: appeal) | ||
end | ||
|
||
def update | ||
@form = form.new(form_params) | ||
|
||
render :show unless update_task_save_continue_or_draft(:application, :second_appeal) | ||
end | ||
|
||
private | ||
|
||
# :nocov: | ||
def form | ||
raise "Implement in subclass" | ||
end | ||
# :nocov: | ||
|
||
def appeal | ||
legal_aid_application.appeal | ||
end | ||
|
||
def form_params | ||
merge_with_model(appeal) do | ||
return {} unless params[:application_merits_task_appeal] | ||
|
||
params.require(:application_merits_task_appeal).permit(:court_type) | ||
end | ||
end | ||
end | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
app/controllers/providers/application_merits_task/first_appeal_court_types_controller.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,11 @@ | ||
module Providers | ||
module ApplicationMeritsTask | ||
class FirstAppealCourtTypesController < BaseAppealCourtTypesController | ||
private | ||
|
||
def form | ||
FirstAppealCourtTypeForm | ||
end | ||
end | ||
end | ||
end |
11 changes: 11 additions & 0 deletions
11
app/controllers/providers/application_merits_task/second_appeal_court_types_controller.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,11 @@ | ||
module Providers | ||
module ApplicationMeritsTask | ||
class SecondAppealCourtTypesController < BaseAppealCourtTypesController | ||
private | ||
|
||
def form | ||
SecondAppealCourtTypeForm | ||
end | ||
end | ||
end | ||
end |
21 changes: 21 additions & 0 deletions
21
app/forms/providers/application_merits_task/base_appeal_court_type_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,21 @@ | ||
module Providers | ||
module ApplicationMeritsTask | ||
class BaseAppealCourtTypeForm < BaseForm | ||
SECOND_APPEAL_COURT_TYPES = %w[ | ||
court_of_appeal | ||
supreme_court | ||
].freeze | ||
|
||
FIRST_APPEAL_COURT_TYPES = | ||
SECOND_APPEAL_COURT_TYPES + %w[ | ||
other_court | ||
].freeze | ||
|
||
# :nocov: | ||
def court_types | ||
raise "Implement in subclass" | ||
end | ||
# :nocov: | ||
end | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
app/forms/providers/application_merits_task/first_appeal_court_type_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,15 @@ | ||
module Providers | ||
module ApplicationMeritsTask | ||
class FirstAppealCourtTypeForm < BaseAppealCourtTypeForm | ||
form_for ::ApplicationMeritsTask::Appeal | ||
|
||
attr_accessor :court_type | ||
|
||
validates :court_type, presence: true, inclusion: { in: FIRST_APPEAL_COURT_TYPES }, unless: :draft? | ||
|
||
def court_types | ||
FIRST_APPEAL_COURT_TYPES | ||
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
15 changes: 15 additions & 0 deletions
15
app/forms/providers/application_merits_task/second_appeal_court_type_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,15 @@ | ||
module Providers | ||
module ApplicationMeritsTask | ||
class SecondAppealCourtTypeForm < BaseAppealCourtTypeForm | ||
form_for ::ApplicationMeritsTask::Appeal | ||
|
||
attr_accessor :court_type | ||
|
||
validates :court_type, presence: true, inclusion: { in: SECOND_APPEAL_COURT_TYPES }, unless: :draft? | ||
|
||
def court_types | ||
SECOND_APPEAL_COURT_TYPES | ||
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
13 changes: 13 additions & 0 deletions
13
app/services/flow/steps/provider_merits/first_appeal_court_types_step.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,13 @@ | ||
module Flow | ||
module Steps | ||
module ProviderMerits | ||
FirstAppealCourtTypesStep = Step.new( | ||
path: ->(application) { Steps.urls.providers_legal_aid_application_first_appeal_court_type_path(application) }, | ||
forward: lambda do |application| | ||
Flow::MeritsLoop.forward_flow(application, :application) | ||
end, | ||
check_answers: :check_merits_answers, | ||
) | ||
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
13 changes: 13 additions & 0 deletions
13
app/services/flow/steps/provider_merits/second_appeal_court_types_step.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,13 @@ | ||
module Flow | ||
module Steps | ||
module ProviderMerits | ||
SecondAppealCourtTypesStep = Step.new( | ||
path: ->(application) { Steps.urls.providers_legal_aid_application_second_appeal_court_type_path(application) }, | ||
forward: lambda do |application| | ||
Flow::MeritsLoop.forward_flow(application, :application) | ||
end, | ||
check_answers: :check_merits_answers, | ||
) | ||
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
25 changes: 25 additions & 0 deletions
25
app/views/providers/application_merits_task/first_appeal_court_types/show.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%= form_with( | ||
url: providers_legal_aid_application_first_appeal_court_type_path, | ||
model: @form, | ||
method: :patch, | ||
local: true, | ||
) do |form| %> | ||
<%= page_template page_title: t(".page_title"), | ||
template: :basic, | ||
form: do %> | ||
|
||
<%= form.govuk_radio_buttons_fieldset(:court_type, | ||
legend: { text: content_for(:page_title), tag: "h1", size: "xl" }, | ||
hint: { text: t(".hint") })do %> | ||
|
||
<% form.object.court_types.each_with_index do |court_type, idx| %> | ||
<%= form.govuk_radio_button :court_type, | ||
court_type, | ||
link_errors: idx.zero?, | ||
label: { text: t(".#{court_type}.label") } %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= next_action_buttons(show_draft: true, form:) %> | ||
<% end %> | ||
<% end %> |
25 changes: 25 additions & 0 deletions
25
app/views/providers/application_merits_task/second_appeal_court_types/show.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<%= form_with( | ||
url: providers_legal_aid_application_second_appeal_court_type_path, | ||
model: @form, | ||
method: :patch, | ||
local: true, | ||
) do |form| %> | ||
<%= page_template page_title: t(".page_title"), | ||
template: :basic, | ||
form: do %> | ||
|
||
<%= form.govuk_radio_buttons_fieldset(:court_type, | ||
legend: { text: content_for(:page_title), tag: "h1", size: "xl" }, | ||
hint: { text: t(".hint") })do %> | ||
|
||
<% form.object.court_types.each_with_index do |court_type, idx| %> | ||
<%= form.govuk_radio_button :court_type, | ||
court_type, | ||
link_errors: idx.zero?, | ||
label: { text: t(".#{court_type}.label") } %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= next_action_buttons(show_draft: true, form:) %> | ||
<% 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
Oops, something went wrong.