Skip to content

Commit

Permalink
Changes since support user authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie committed Dec 21, 2023
1 parent a082b78 commit 13c4fc5
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Placements::ProviderSuggestionsController < ApplicationController
class Placements::Support::ProviderSuggestionsController < Placements::Support::ApplicationController
def index
accredited_providers = AccreditedProviderApi.call
filtered_providers = filter_providers(accredited_providers, params[:query])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class Placements::ProvidersController < ApplicationController
class Placements::Support::ProvidersController < Placements::Support::ApplicationController
def new
@provider = Provider.new
end

def create
@provider = Provider.find_or_initialize_by(provider_params)
if @provider.save
redirect_to root_path
redirect_to placements_support_organisations_path
else
render :new
end
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/accredited_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const onConfirm = (input) => (option) =>

function init() {
const options = {
path: `/provider_suggestions`,
path: `/support/provider_suggestions`,
template: {
inputValue: providerTemplate,
suggestion: providerSuggestionTemplate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<%= content_for(:before_content) do %>
<%= govuk_back_link(href: new_placements_provider_path) %>
<%= govuk_back_link(href: new_placements_support_provider_path) %>
<% end %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_with(model: @provider, url: placements_providers_path, method: "post", data: {turbo: false}) do |f| %>
<%= form_with(model: @provider, url: placements_support_providers_path, method: "post", data: {turbo: false}) do |f| %>
<%= f.hidden_field :provider_code, value: @selected_provider["attributes"]["code"] %>

<label class="govuk-label govuk-label--l">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= govuk_back_link(href: root_path) %>
<% end %>

<%= form_with(model: @provider, url: check_placements_providers_path, method: "get", data: {turbo: false}) do |f| %>
<%= form_with(model: @provider, url: check_placements_support_providers_path, method: "get", data: {turbo: false}) do |f| %>
<%= f.govuk_error_summary %>

<div class="govuk-grid-row">
Expand Down
35 changes: 18 additions & 17 deletions config/locales/placements/en/layouts/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ en:
header:
service_name: Manage School Placements
placements:
providers:
new:
caption: Add organisation
cancel: Cancel
continue: Continue
title: Enter a provider name, UKPRN, URN or postcode
check:
accredited_provider_id: Accredited provider ID
add_organisation: Add organisation
address: Address
cancel: Cancel
email: Email address
organisation_name: Organisation name
telephone: Telephone number
title: Check your answers
ukprn: UK provider reference number (UKPRN)
website: Website
support:
providers:
new:
caption: Add organisation
cancel: Cancel
continue: Continue
title: Enter a provider name, UKPRN, URN or postcode
check:
accredited_provider_id: Accredited provider ID
add_organisation: Add organisation
address: Address
cancel: Cancel
email: Email address
organisation_name: Organisation name
telephone: Telephone number
title: Check your answers
ukprn: UK provider reference number (UKPRN)
website: Website
85 changes: 0 additions & 85 deletions spec/requests/placements/providers_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
and_i_click_continue
then_i_see_the_check_details_page_for_provider("Provider 1")
when_i_click_add_organisation
then_i_return_to_the_root_path
then_i_return_to_support_organisations_index
and_a_provider_code_is_listed(provider_code: "Prov1")
end

scenario "Colin adds a Provider which already exists", js: true do
Expand All @@ -53,7 +54,7 @@ def given_i_am_on_the_placements_site
end

def and_there_is_an_existing_persona_for(persona_name)
create(:persona, persona_name.downcase.to_sym)
create(:persona, persona_name.downcase.to_sym, service: :placements)
end

def and_i_visit_the_personas_page
Expand All @@ -65,7 +66,7 @@ def and_i_click_sign_in_as(persona_name)
end

def when_i_visit_the_add_provider_page
visit new_placements_provider_path
visit new_placements_support_provider_path
end

def given_i_sign_in_as_colin
Expand Down Expand Up @@ -102,8 +103,8 @@ def when_i_click_add_organisation
click_on "Add organisation"
end

def then_i_return_to_the_root_path
expect(page).to have_content("It works!")
def then_i_return_to_support_organisations_index
expect(page).to have_content("Organisations")
end

def given_a_provider_already_exists(code:)
Expand All @@ -116,4 +117,8 @@ def then_i_see_an_error(error_message)
)
expect(page.find(".govuk-error-summary")).to have_content(error_message)
end

def and_a_provider_code_is_listed(provider_code:)
expect(page).to have_content(provider_code)
end
end

0 comments on commit 13c4fc5

Please sign in to comment.