-
Notifications
You must be signed in to change notification settings - Fork 9
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 #4331 from DFE-Digital/cv/move-school-placements
Move school placements into its own view
- Loading branch information
Showing
17 changed files
with
252 additions
and
15 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
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module Find | ||
class PlacementsController < ApplicationController | ||
before_action -> { render_not_found if provider.nil? } | ||
|
||
def index | ||
@course = provider.courses.includes( | ||
:enrichments, | ||
subjects: [:financial_incentive], | ||
site_statuses: [:site] | ||
).find_by!(course_code: params[:course_code]&.upcase).decorate | ||
|
||
render_not_found unless @course.is_published? | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<%= content_for :page_title do %> | ||
<%= t( | ||
"find.courses.placements.heading", | ||
provider_name: @course.provider_name | ||
) %> | ||
<% end %> | ||
<% content_for :before_content do %> | ||
<%= govuk_back_link( | ||
href: search_ui_course_page_url( | ||
provider_code: @course.provider_code, | ||
course_code: @course.course_code | ||
), | ||
text: t( | ||
"find.courses.placements.back", | ||
course_name: @course.name, | ||
course_code: @course.course_code | ||
) | ||
) %> | ||
<% end %> | ||
|
||
<%= render partial: "shared/courses/placements", locals: { course: @course } %> |
22 changes: 22 additions & 0 deletions
22
app/views/publish/courses/school_placements/index.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,22 @@ | ||
<%= content_for :page_title do %> | ||
<%= t( | ||
"publish.providers.courses.placements.heading", | ||
provider_name: @course.provider_name | ||
) %> | ||
<% end %> | ||
<% content_for :before_content do %> | ||
<%= govuk_back_link( | ||
href: preview_publish_provider_recruitment_cycle_course_path( | ||
@course.provider_code, | ||
@course.recruitment_cycle_year, | ||
@course.course_code | ||
), | ||
text: t( | ||
"publish.providers.courses.placements.back", | ||
course_name: @course.name, | ||
course_code: @course.course_code | ||
) | ||
) %> | ||
<% end %> | ||
|
||
<%= render partial: "shared/courses/placements", locals: { course: @course } %> |
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 @@ | ||
<h1 class="govuk-heading-xl"> | ||
<%= t(".heading", provider_name: course.provider_name) %> | ||
</h1> | ||
|
||
<%= govuk_warning_text(text: t(".warning")) %> | ||
|
||
<p class="govuk-body"> | ||
<%= t(".will_place_you", provider_name: course.provider_name) %> | ||
</p> | ||
|
||
<p class="govuk-body"><%= t(".schools_to_be_placed") %></p> | ||
|
||
<ul class="govuk-list govuk-list--spaced" id="course_school_placements"> | ||
<% course.preview_site_statuses.each do |site_status| %> | ||
<li> | ||
<strong><%= smart_quotes(site_status.site.location_name) %></strong> | ||
<br> | ||
<%= smart_quotes(site_status.site.decorate.full_address) %> | ||
</li> | ||
<% end %> | ||
</ul> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
module Find | ||
describe PlacementsController do | ||
before do | ||
Timecop.travel(Find::CycleTimetable.mid_cycle) | ||
end | ||
|
||
describe '#placements' do | ||
context 'when provider is not pressent' do | ||
it 'renders the not found page' do | ||
get :index, params: { | ||
provider_code: 'ABC', | ||
course_code: '123' | ||
} | ||
|
||
expect(response).to render_template('errors/not_found') | ||
end | ||
end | ||
|
||
context 'when course is not published' do | ||
it 'renders the not found page' do | ||
provider = create(:provider) | ||
course = create(:course, provider:) | ||
|
||
get :index, params: { | ||
provider_code: provider.provider_code, | ||
course_code: course.course_code | ||
} | ||
|
||
expect(response).to render_template('errors/not_found') | ||
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