diff --git a/app/controllers/personas_controller.rb b/app/controllers/personas_controller.rb index 26d2d0873c..b85ff08681 100644 --- a/app/controllers/personas_controller.rb +++ b/app/controllers/personas_controller.rb @@ -2,10 +2,6 @@ class PersonasController < ApplicationController def index - if current_service.present? - @personas = Persona.public_send(current_service).decorate - else - redirect_to :not_found - end + @personas = Persona.public_send(current_service).decorate end end diff --git a/app/controllers/placements/support/application_controller.rb b/app/controllers/placements/support/application_controller.rb index d37f601251..c61b3191da 100644 --- a/app/controllers/placements/support/application_controller.rb +++ b/app/controllers/placements/support/application_controller.rb @@ -5,7 +5,7 @@ class Placements::Support::ApplicationController < ApplicationController def authenticate_support_user! authenticate_user! - + if support_user.blank? redirect_to placements_root_path, alert: "You cannot perform this action" end diff --git a/app/controllers/placements/support/organisations_controller.rb b/app/controllers/placements/support/organisations_controller.rb new file mode 100644 index 0000000000..a8c8fdcda3 --- /dev/null +++ b/app/controllers/placements/support/organisations_controller.rb @@ -0,0 +1,7 @@ +class Placements::Support::OrganisationsController < Placements::Support::ApplicationController + def index + @schools = Placements::School.includes(:gias_school) + # TODO: when we have more from the provider API.... + @providers = Provider.all + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e1e82abc86..0b096a66e4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -7,13 +7,4 @@ def current_service :placements end end - - def root_path - case current_service - when :claims - claims_root_path - when :placements - placements_root_path - end - end end diff --git a/app/models/school.rb b/app/models/school.rb index ba55941bb5..03474cf165 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -20,6 +20,8 @@ class School < ApplicationRecord validates :urn, presence: true validates :urn, uniqueness: { case_sensitive: false } + delegate :name, to: :gias_school + scope :placements, -> { where placements: true } scope :claims, -> { where claims: true } end diff --git a/app/views/placements/support/organisations/index.html.erb b/app/views/placements/support/organisations/index.html.erb new file mode 100644 index 0000000000..bcf556cb39 --- /dev/null +++ b/app/views/placements/support/organisations/index.html.erb @@ -0,0 +1,23 @@ +
+
+

<%= t("organisations").capitalize %>

+ + <% if @schools.any? %> +

<%= t("schools").capitalize %>

+ + <% end %> + + <% if @providers.any? %> +

<%= t("providers").capitalize %>

+ + <% end %> +
+
diff --git a/config/locales/en.yml b/config/locales/en.yml index e3b586c4e6..08781ad202 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,4 +1,7 @@ en: + organisations: organisations + schools: schools + providers: providers account: index: email_address: Email address diff --git a/spec/features/personas/sign_in_as_a_placements_user_persona_spec.rb b/spec/features/personas/sign_in_as_a_placements_user_persona_spec.rb index e4f2e614a1..68c94b1725 100644 --- a/spec/features/personas/sign_in_as_a_placements_user_persona_spec.rb +++ b/spec/features/personas/sign_in_as_a_placements_user_persona_spec.rb @@ -60,9 +60,9 @@ def when_i_visit_the_personas_page end def and_there_are_placement_organisations - create(:gias_school, name: "Placement School") - create(:school, :placements) - create(:provider, id: 123_456_789) + gias_school = create(:gias_school, name: "Placement School") + create(:school, :placements, urn: gias_school.urn) + create(:provider, provider_code: "PROVIDER_CODE") end def then_i_see_the_persona_for(persona_name) @@ -78,10 +78,9 @@ def and_i_visit_my_account_page end def then_i_see_a_list_of_organisations - expect(path).to eq dashboard_path - expect(page).to have_content("Placements School") - # We won't have a name or data for the providers until after the Provider API integration is done - expect(page).to have_content("123456789") + expect(current_path).to eq placements_support_organisations_path + expect(page).to have_content("Placement School") + expect(page).to have_content("PROVIDER_CODE") end def then_i_see_persona_details_for_anne