Browse Source

Add banner to the schemes page

pull/2655/head
Kat 2 years ago committed by kosiakkatrina
parent
commit
60a071db88
  1. 0
      app/views/organisations/duplicate_schemes.html.erb
  2. 10
      app/views/organisations/schemes.html.erb
  3. 1
      config/routes.rb
  4. 18
      spec/requests/organisations_controller_spec.rb

0
app/views/organisations/duplicate_schemes.html.erb

10
app/views/organisations/schemes.html.erb

@ -11,6 +11,16 @@
) %> ) %>
<h2 class="govuk-visually-hidden">Supported housing schemes</h2> <h2 class="govuk-visually-hidden">Supported housing schemes</h2>
<% end %> <% end %>
<% if display_duplicate_schemes_banner?(@organisation, current_user) %>
<%= govuk_notification_banner(title_text: "Important") do %>
<p class="govuk-notification-banner__heading govuk-!-width-full" style="max-width: fit-content">
Some schemes and locations might be duplicates.
<p>
<%= govuk_link_to "Review possible duplicates", href: schemes_duplicates_organisation_path(@organisation) %>
<% end %>
<% end %>
<div class="app-filter-layout" data-controller="filter-layout"> <div class="app-filter-layout" data-controller="filter-layout">
<% if SchemePolicy.new(current_user, nil).create? %> <% if SchemePolicy.new(current_user, nil).create? %>
<%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %> <%= govuk_button_link_to "Create a new supported housing scheme", new_scheme_path, html: { method: :post } %>

1
config/routes.rb

@ -178,6 +178,7 @@ Rails.application.routes.draw do
get "schemes/csv-download", to: "organisations#download_schemes_csv" get "schemes/csv-download", to: "organisations#download_schemes_csv"
post "schemes/email-csv", to: "organisations#email_schemes_csv" post "schemes/email-csv", to: "organisations#email_schemes_csv"
get "schemes/csv-confirmation", to: "schemes#csv_confirmation" get "schemes/csv-confirmation", to: "schemes#csv_confirmation"
get "schemes/duplicates", to: "organisations#duplicate_schemes"
get "stock-owners", to: "organisation_relationships#stock_owners" get "stock-owners", to: "organisation_relationships#stock_owners"
get "stock-owners/add", to: "organisation_relationships#add_stock_owner" get "stock-owners/add", to: "organisation_relationships#add_stock_owner"
get "stock-owners/remove", to: "organisation_relationships#remove_stock_owner" get "stock-owners/remove", to: "organisation_relationships#remove_stock_owner"

18
spec/requests/organisations_controller_spec.rb

@ -207,6 +207,24 @@ RSpec.describe OrganisationsController, type: :request do
expect(page).to have_title("#{user.organisation.name} (1 scheme matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK") expect(page).to have_title("#{user.organisation.name} (1 scheme matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end end
end end
context "when organisation has absorbed other organisations" do
before do
create(:organisation, merge_date: Time.zone.today, absorbing_organisation: organisation)
end
context "and it has duplicate schemes or locations" do
before do
create_list(:scheme, 2, :duplicate, owning_organisation: organisation)
get "/organisations/#{organisation.id}/schemes", headers:, params: {}
end
it "displays a banner with correct content" do
expect(page).to have_content("Some schemes and locations might be duplicates.")
expect(page).to have_link("Review possible duplicates", href: "/organisations/#{organisation.id}/schemes/duplicates")
end
end
end
end end
context "when data coordinator user" do context "when data coordinator user" do

Loading…
Cancel
Save