Skip to content

Commit

Permalink
Rename ProviderPartnership controller to AccreditedPartnership
Browse files Browse the repository at this point in the history
  • Loading branch information
inulty-dfe committed Dec 19, 2024
1 parent 710a800 commit 5bb0be2
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/components/add_course_button_partnerships.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def incomplete_sections
def incomplete_sections_hash
{
site_not_present?: publish_provider_recruitment_cycle_schools_path(provider.provider_code, provider.recruitment_cycle_year),
accredited_partner_not_present?: publish_provider_recruitment_cycle_provider_partnerships_path(provider.provider_code, provider.recruitment_cycle_year)
accredited_partner_not_present?: publish_provider_recruitment_cycle_accredited_partnerships_path(provider.provider_code, provider.recruitment_cycle_year)
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Publish
module Providers
module ProviderPartnerships
module AccreditedPartnerships
class ChecksController < PublishController
def show
provider_partnership_form
Expand All @@ -14,7 +14,7 @@ def update
if @partnership.save
notify_accredited_provider_users

redirect_to publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year), flash: { success: 'Accredited partnership added' }
redirect_to publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year), flash: { success: 'Accredited partnership added' }
else
render :show
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Publish
module Providers
class ProviderPartnershipsController < PublishController
class AccreditedPartnershipsController < PublishController
helper_method :accredited_provider_id

def index; end
Expand All @@ -23,7 +23,7 @@ def create
@provider_partnership_form = ProviderPartnershipForm.new(current_user, @provider_partnership, params: partnership_params)

if @provider_partnership_form.stash
redirect_to check_publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, recruitment_cycle.year)
redirect_to check_publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, recruitment_cycle.year)
else
render :new
end
Expand All @@ -35,7 +35,7 @@ def update

if @provider_partnership_form.save!
flash[:success] = t('publish.providers.provider_partnerships.edit.updated')
redirect_to publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, recruitment_cycle.year)
redirect_to publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, recruitment_cycle.year)
else
render :edit
end
Expand All @@ -51,7 +51,7 @@ def destroy

if @partnership.destroy
flash[:success] = t('publish.providers.provider_partnerships.delete.updated')
redirect_to publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, recruitment_cycle.year)
redirect_to publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, recruitment_cycle.year)
else
render :delete
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def new
def create
if accredited_provider_id.present?
if Settings.features.provider_partnerships
redirect_to new_publish_provider_recruitment_cycle_provider_partnership_path(
redirect_to new_publish_provider_recruitment_cycle_accredited_partnership_path(
provider_code: provider.provider_code,
recruitment_cycle_year: provider.recruitment_cycle_year,
accredited_provider_id:
Expand Down Expand Up @@ -43,7 +43,7 @@ def update

if @accredited_provider_select_form.valid?
if Settings.features.provider_partnerships
redirect_to new_publish_provider_recruitment_cycle_provider_partnership_path(
redirect_to new_publish_provider_recruitment_cycle_accredited_partnership_path(
provider_code: provider.provider_code,
recruitment_cycle_year: provider.recruitment_cycle_year,
accredited_provider_id: accredited_provider_select_params[:provider_id]
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/goto_confirmation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def back_link_for_adding_accredited_partner_path(param_form_key:, params:, recru

def publish_back_link_for_adding_provider_partnership_path(param_form_key:, params:, recruitment_cycle_year:, provider:)
with_partnerships = if goto_confirmation?(param_form_key:, params:)
check_publish_provider_recruitment_cycle_provider_partnerships_path(provider.provider_code, recruitment_cycle_year)
check_publish_provider_recruitment_cycle_accredited_partnerships_path(provider.provider_code, recruitment_cycle_year)
elsif param_form_key == :publish_accredited_provider_form
search_publish_provider_recruitment_cycle_provider_partnerships_path(provider.provider_code, recruitment_cycle_year)
search_publish_provider_recruitment_cycle_accredited_partnerships_path(provider.provider_code, recruitment_cycle_year)
else
publish_provider_recruitment_cycle_provider_partnerships_path(provider.provider_code, recruitment_cycle_year)
publish_provider_recruitment_cycle_accredited_partnerships_path(provider.provider_code, recruitment_cycle_year)
end

return with_partnerships if Settings.features.provider_partnerships
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/navigation_bar_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def partnership_links(provider)
if provider.accredited_provider?
{ name: t('navigation_bar.training_partners'), url: publish_provider_recruitment_cycle_training_providers_path(provider.provider_code, provider.recruitment_cycle_year) }
else
{ name: t('navigation_bar.accredited_partnerships'), url: publish_provider_recruitment_cycle_provider_partnerships_path(provider.provider_code, provider.recruitment_cycle_year) }
{ name: t('navigation_bar.accredited_partnerships'), url: publish_provider_recruitment_cycle_accredited_partnerships_path(provider.provider_code, provider.recruitment_cycle_year) }
end
elsif provider.accredited_provider?
{ name: t('navigation_bar.training_partners'), url: publish_provider_recruitment_cycle_training_providers_path(provider.provider_code, provider.recruitment_cycle_year) }
Expand Down
2 changes: 1 addition & 1 deletion app/views/publish/courses/_basic_details_tab.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
heading = "Ratifying provider"
partners = @provider.accredited_partners
add_provider_text = "Add at least one accredited partner"
add_provider_link = publish_provider_recruitment_cycle_provider_partnerships_path(@course.provider_code, @course.recruitment_cycle_year)
add_provider_link = publish_provider_recruitment_cycle_accredited_partnerships_path(@course.provider_code, @course.recruitment_cycle_year)
select_partner_text = "Select an accredited partner"
select_partner_link = ratifying_provider_publish_provider_recruitment_cycle_course_path(@course.provider_code, @course.recruitment_cycle_year, @course.course_code)
change_partner_link = ratifying_provider_publish_provider_recruitment_cycle_course_path(@provider.provider_code, course.recruitment_cycle_year, course.course_code)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= content_for :page_title, t("publish.providers.provider_partnerships.delete.title") %>

<% content_for :before_content do %>
<%= govuk_back_link_to(publish_provider_recruitment_cycle_provider_partnerships_path) %>
<%= govuk_back_link_to(publish_provider_recruitment_cycle_accredited_partnerships_path) %>
<% end %>

<div class="govuk-grid-row">
Expand All @@ -12,12 +12,12 @@
</h1>

<%= govuk_button_to "Remove accredited partnership",
delete_publish_provider_recruitment_cycle_provider_partnership_path,
delete_publish_provider_recruitment_cycle_accredited_partnership_path,
method: :delete,
class: "govuk-button--warning" %>

<p class="govuk-body">
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_provider_partnerships_path) %>
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_accredited_partnerships_path) %>
</p>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</p>

<p class="govuk-body">
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_provider_partnerships_path) %>
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_accredited_partnerships_path) %>
</p>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
) %>

<% content_for :before_content do %>
<%= govuk_back_link_to(new_publish_provider_recruitment_cycle_provider_partnership_path(provider_code: @provider.provider_code,
<%= govuk_back_link_to(new_publish_provider_recruitment_cycle_accredited_partnership_path(provider_code: @provider.provider_code,
recruitment_cycle_year: @provider.recruitment_cycle_year)) %>
<% end %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">

<%= form_with(url: check_publish_provider_recruitment_cycle_provider_partnerships_path, method: :put, local: true) do |f| %>
<%= form_with(url: check_publish_provider_recruitment_cycle_accredited_partnerships_path, method: :put, local: true) do |f| %>
<h1 class="govuk-heading-l">
<span class="govuk-caption-l"><%= t(".caption") %></span>
Check your answers
Expand All @@ -26,7 +26,7 @@
component.with_row do |row|
row.with_key { "About the accredited provider" }
row.with_value { markdown @provider_partnership_form.description }
row.with_action(text: "Change", href: new_publish_provider_recruitment_cycle_provider_partnership_path(goto_confirmation: true), visually_hidden_text: "accredited provider description")
row.with_action(text: "Change", href: new_publish_provider_recruitment_cycle_accredited_partnership_path(goto_confirmation: true), visually_hidden_text: "accredited provider description")
end
end %>

Expand All @@ -36,7 +36,7 @@
<% end %>

<p class="govuk-body">
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year)) %>
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year)) %>
</p>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<%= form_with(
model: @provider_partnership_form,
url: publish_provider_recruitment_cycle_provider_partnership_path,
url: publish_provider_recruitment_cycle_accredited_partnership_path,
method: :put
) do |f| %>

Expand All @@ -12,7 +12,7 @@
<div class="govuk-grid-column-two-thirds">

<% content_for :before_content do %>
<%= govuk_back_link_to(publish_provider_recruitment_cycle_provider_partnerships_path) %>
<%= govuk_back_link_to(publish_provider_recruitment_cycle_accredited_partnerships_path) %>
<% end %>

<%= f.govuk_text_area(
Expand All @@ -29,7 +29,7 @@
<%= f.govuk_submit "Update description" %>

<p class="govuk-body">
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_provider_partnerships_path) %>
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_accredited_partnerships_path) %>
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<p class="govuk-body">There are no accredited providers for <%= @provider.provider_name %>.</p>
<% else %>
<% @provider.accredited_partnerships.each do |partnership| %>
<%= render AccreditedProviderComponent.new(provider_name: partnership.accredited_provider.provider_name, remove_path: delete_publish_provider_recruitment_cycle_provider_partnership_path(accredited_provider_code: partnership.accredited_provider.provider_code), about_accredited_provider: partnership.description, change_about_accredited_provider_path: edit_publish_provider_recruitment_cycle_provider_partnership_path(accredited_provider_code: partnership.accredited_provider.provider_code)) %>
<%= render AccreditedProviderComponent.new(provider_name: partnership.accredited_provider.provider_name, remove_path: delete_publish_provider_recruitment_cycle_accredited_partnership_path(accredited_provider_code: partnership.accredited_provider.provider_code), about_accredited_provider: partnership.description, change_about_accredited_provider_path: edit_publish_provider_recruitment_cycle_provider_partnership_path(accredited_provider_code: partnership.accredited_provider.provider_code)) %>
<% end %>
<% end %>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<%= form_with(
model: @provider_partnership_form,
url: publish_provider_recruitment_cycle_provider_partnerships_path,
url: publish_provider_recruitment_cycle_accredited_partnerships_path,
method: :post
) do |f| %>

Expand All @@ -29,7 +29,7 @@
<%= f.govuk_submit t("continue") %>

<p class="govuk-body">
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_provider_partnerships_path) %>
<%= govuk_link_to(t("cancel"), publish_provider_recruitment_cycle_accredited_partnerships_path) %>
</p>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions config/routes/publish.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@

constraints(::Constraints::PartnershipFeature.new(:on)) do
get '/publish/organisations/:provider_code/:recruitment_cycle_year/accredited-providers', to: redirect('/publish/organisations/:provider_code/:recruitment_cycle_year/provider-partnerships')
resources :provider_partnerships, param: :accredited_provider_code, except: %i[show], path: 'provider-partnerships', controller: 'provider_partnerships' do
resources :accredited_partnerships, param: :accredited_provider_code, except: %i[show], path: 'provider-partnerships', controller: 'accredited_partnerships' do
member do
get :delete
delete :delete, to: 'provider_partnerships#destroy'
delete :delete, to: 'accredited_partnerships#destroy'
end

get '/check', on: :collection, to: 'provider_partnerships/checks#show'
put '/check', on: :collection, to: 'provider_partnerships/checks#update'
get '/check', on: :collection, to: 'accredited_partnerships/checks#show'
put '/check', on: :collection, to: 'accredited_partnerships/checks#update'
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/features/publish/accredited_partnership_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ def and_the_accredited_provider_is_saved_to_the_database
end

def then_i_should_be_taken_to_the_accredited_provider_description_page
expect(page).to have_current_path(new_publish_provider_recruitment_cycle_provider_partnership_path(@provider.provider_code, @provider.recruitment_cycle_year, goto_confirmation: true))
expect(page).to have_current_path(new_publish_provider_recruitment_cycle_accredited_partnership_path(@provider.provider_code, @provider.recruitment_cycle_year, goto_confirmation: true))
end

def then_i_should_be_taken_back_to_the_confirm_page
expect(page).to have_current_path(check_publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year))
expect(page).to have_current_path(check_publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year))
end

def when_i_click_the_back_link
Expand Down Expand Up @@ -170,7 +170,7 @@ def and_i_see_the_remove_success_message
end

def then_i_should_be_taken_to_the_index_page
expect(page).to have_current_path(publish_provider_recruitment_cycle_provider_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year))
expect(page).to have_current_path(publish_provider_recruitment_cycle_accredited_partnerships_path(@provider.provider_code, @provider.recruitment_cycle_year))
end

def when_i_confirm_the_changes
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/navigation_bar_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
end

it 'includes the correct link to accredited providers' do
expect(accredited_provider_item[:url]).to eq publish_provider_recruitment_cycle_provider_partnerships_path(provider.provider_code, provider.recruitment_cycle.year)
expect(accredited_provider_item[:url]).to eq publish_provider_recruitment_cycle_accredited_partnerships_path(provider.provider_code, provider.recruitment_cycle.year)
end
end
end
Expand Down

0 comments on commit 5bb0be2

Please sign in to comment.