From c3c07e3e152ea26a4db94c0b9c90ac6f4ee1af9d Mon Sep 17 00:00:00 2001 From: Lori Bailey <44073106+elceebee@users.noreply.github.com> Date: Tue, 19 Dec 2023 17:31:31 +0000 Subject: [PATCH] Add organisations controller and view --- app/controllers/personas_controller.rb | 6 +---- .../support/application_controller.rb | 2 +- .../support/organisations_controller.rb | 7 ++++++ app/helpers/application_helper.rb | 9 -------- app/models/school.rb | 2 ++ .../support/organisations/index.html.erb | 23 +++++++++++++++++++ config/locales/en.yml | 3 +++ ...gn_in_as_a_placements_user_persona_spec.rb | 13 +++++------ 8 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 app/controllers/placements/support/organisations_controller.rb create mode 100644 app/views/placements/support/organisations/index.html.erb 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 @@ +