generated from dxw/rails-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e&o): add school picker to case creation
Jira: PWNN-1659
- Loading branch information
1 parent
2cf512d
commit 4a9f710
Showing
50 changed files
with
844 additions
and
1,619 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
app/controllers/engagement/case_requests/school_pickers_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,32 @@ | ||
module Engagement | ||
module CaseRequests | ||
class SchoolPickersController < ApplicationController | ||
before_action :case_request, only: %i[edit update] | ||
|
||
def edit | ||
@back_url = params[:source] == "change_link" ? engagement_case_request_path(@case_request) : edit_engagement_case_request_path(@case_request) | ||
@school_picker = @case_request.school_picker | ||
@group = @case_request.organisation | ||
@all_schools = @group.organisations.order(:name) | ||
@filters = @all_schools.filtering(form_params[:filters] || {}) | ||
@filtered_schools = @filters.results.map { |s| Support::OrganisationPresenter.new(s) } | ||
end | ||
|
||
def update | ||
@school_picker = @case_request.school_picker(school_urns: form_params[:school_urns].compact_blank.excluding("all")) | ||
@school_picker.save! | ||
redirect_to engagement_case_request_path(@case_request) | ||
end | ||
|
||
private | ||
|
||
def case_request | ||
@case_request = CaseRequest.find_by(id: params[:id]) | ||
end | ||
|
||
def form_params | ||
params.fetch(:case_request, {}).permit(filters: params.key?(:clear) ? nil : { local_authorities: [], phases: [] }, school_urns: []) | ||
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 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 was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
app/controllers/support/cases/request_details/participating_schools_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,12 @@ | ||
module Support | ||
module Cases | ||
module RequestDetails | ||
class ParticipatingSchoolsController < Cases::ApplicationController | ||
def show | ||
@back_url = support_case_request_details_path | ||
@participating_schools = @current_case.request.selected_schools.map { |s| Support::OrganisationPresenter.new(s) } | ||
end | ||
end | ||
end | ||
end | ||
end |
4 changes: 2 additions & 2 deletions
4
...lers/support/cases/requests_controller.rb → ...pport/cases/request_details_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
12 changes: 0 additions & 12 deletions
12
app/controllers/support/cases/requests/participating_schools_controller.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
Oops, something went wrong.