Browse Source

CLDC-2691 Miscellaneous navigation bug fixes (#2080)

* WIP commit

* feat:tidy up routing and fix scheme tab current bug

* feat: revert user_cell update

* feat: use latest merge date/start date where available for availability text for schemes and locations

* feat: add tests for availability text

* feat: include schema

* feat: use startdate instead to track merges on schemes and locations

* feat: test startdates are set correctly on merged schemes and locations

* feat: update schema

* refactor: lint

* feat: add migration file

* feat: update schema

* feat: add back links

* feat: tidy navigation bar behaviour

* feat: update scope auth

* faet: update page titles

* feat: simplify titles and revert some bulk upload dependent navigation behaviour

* feat: update support user tab titles and search bar text

* feat: give support users breadcrumbs to individual org obejcts for schemes, users and logs

* feat: add user param to log breadcrumbs

* refactor: erblint

* feat: update schema

* Revert "Merge branch 'CLDC-2996-merged-scheme-activation-date-bug' into CLDC-2691-support-nav-bug"

This reverts commit 37d4b1e194, reversing
changes made to 1d76829922.

* feat: update tests

* feat: update tests

* feat: simplify log type methods

* feat: simplify log title

* feat: update locations tab breadcrumbs to show owning scheme

* feat: use correct scheme path

* feat: update breadcrumbs in check ansewrs and review pages

* feat: update tests
pull/2088/head v0.3.83
natdeanlewissoftwire 1 year ago committed by GitHub
parent
commit
6b9b94399f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      app/helpers/logs_helper.rb
  2. 8
      app/helpers/navigation_items_helper.rb
  3. 4
      app/helpers/review_helper.rb
  4. 21
      app/helpers/tasklist_helper.rb
  5. 2
      app/views/form/check_answers.html.erb
  6. 16
      app/views/locations/index.html.erb
  7. 2
      app/views/logs/edit.html.erb
  8. 2
      app/views/logs/index.html.erb
  9. 2
      app/views/organisation_relationships/managing_agents.html.erb
  10. 4
      app/views/organisations/data_sharing_agreement.html.erb
  11. 18
      app/views/organisations/logs.html.erb
  12. 15
      app/views/schemes/show.html.erb
  13. 11
      app/views/users/show.html.erb
  14. 10
      spec/features/lettings_log_spec.rb
  15. 10
      spec/features/sales_log_spec.rb
  16. 27
      spec/features/schemes_spec.rb
  17. 34
      spec/helpers/navigation_items_helper_spec.rb
  18. 14
      spec/requests/lettings_logs_controller_spec.rb
  19. 10
      spec/requests/sales_logs_controller_spec.rb

19
app/helpers/logs_helper.rb

@ -20,17 +20,24 @@ module LogsHelper
end
end
def search_label_for_action(action_name)
case action_name
when "lettings_logs" then "Search by log ID, tenant code, property reference or postcode"
when "sales_logs" then "Search by log ID, purchaser code or postcode"
end
end
def csv_download_url_for_controller(controller:, search:, codes_only:)
case log_type_for_controller(controller)
when "lettings" then csv_download_lettings_logs_path(search:, codes_only:)
when "sales" then csv_download_sales_logs_path(search:, codes_only:)
case controller.class.name
when "LettingsLogsController" then csv_download_lettings_logs_path(search:, codes_only:)
when "SalesLogsController" then csv_download_sales_logs_path(search:, codes_only:)
end
end
def logs_path_for_controller(controller)
case log_type_for_controller(controller)
when "lettings" then lettings_logs_path
when "sales" then sales_logs_path
case controller.class.name
when "LettingsLogsController" then lettings_logs_path
when "SalesLogsController" then sales_logs_path
end
end

8
app/helpers/navigation_items_helper.rb

@ -16,7 +16,7 @@ module NavigationItemsHelper
NavigationItem.new("Sales logs", sales_logs_path, sales_logs_current?(path)),
(NavigationItem.new("Schemes", schemes_path, non_support_supported_housing_schemes_current?(path)) if current_user.organisation.holds_own_stock? || current_user.organisation.stock_owners.present?),
NavigationItem.new("Users", users_organisation_path(current_user.organisation), subnav_users_path?(path)),
NavigationItem.new("About your organisation", organisation_path(current_user.organisation.id), subnav_details_path?(path)),
NavigationItem.new("About your organisation", details_organisation_path(current_user.organisation.id), subnav_details_path?(path)),
NavigationItem.new("Stock owners", stock_owners_organisation_path(current_user.organisation), stock_owners_path?(path)),
NavigationItem.new("Managing agents", managing_agents_organisation_path(current_user.organisation), managing_agents_path?(path)),
].compact
@ -29,16 +29,16 @@ module NavigationItemsHelper
NavigationItem.new("Sales logs", sales_logs_organisation_path(current_organisation_id), subnav_sales_logs_path?(path)),
(NavigationItem.new("Schemes", schemes_organisation_path(current_organisation_id), subnav_supported_housing_schemes_path?(path)) if current_user.organisation.holds_own_stock? || current_user.organisation.stock_owners.present?),
NavigationItem.new("Users", users_organisation_path(current_organisation_id), subnav_users_path?(path)),
NavigationItem.new("About this organisation", organisation_path(current_organisation_id), subnav_details_path?(path)),
NavigationItem.new("About this organisation", details_organisation_path(current_organisation_id), subnav_details_path?(path)),
NavigationItem.new("Stock owners", stock_owners_organisation_path(current_organisation_id), stock_owners_path?(path)),
NavigationItem.new("Managing agents", managing_agents_organisation_path(current_organisation_id), managing_agents_path?(path)),
].compact
end
def scheme_items(path, current_scheme_id, title)
def scheme_items(path, current_scheme_id)
[
NavigationItem.new("Scheme", scheme_path(current_scheme_id), !path.include?("locations")),
NavigationItem.new(title, scheme_locations_path(current_scheme_id), path.include?("locations")),
NavigationItem.new("Locations", scheme_locations_path(current_scheme_id), path.include?("locations")),
]
end

4
app/helpers/review_helper.rb

@ -14,12 +14,12 @@ module ReviewHelper
class_name = log.class.model_name.human.downcase
if log.collection_closed_for_editing?
content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => url_for(log.class),
breadcrumb_logs_title(log, current_user) => breadcrumb_logs_link(log, current_user),
"Log #{log.id}" => "",
})
else
content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => url_for(log.class),
breadcrumb_logs_title(log, current_user) => breadcrumb_logs_link(log, current_user),
"Log #{log.id}" => url_for(log),
"Review #{class_name}" => "",
})

21
app/helpers/tasklist_helper.rb

@ -2,6 +2,23 @@ module TasklistHelper
include GovukLinkHelper
include CollectionTimeHelper
def breadcrumb_logs_title(log, current_user)
log_type = log.lettings? ? "Lettings" : "Sales"
if current_user.support? && breadcrumb_organisation(log).present?
"#{log_type} logs (#{breadcrumb_organisation(log).name})"
else
"#{log_type} logs"
end
end
def breadcrumb_logs_link(log, current_user)
if current_user.support? && breadcrumb_organisation(log).present?
log.lettings? ? lettings_logs_organisation_path(breadcrumb_organisation(log)) : sales_logs_organisation_path(breadcrumb_organisation(log))
else
log.lettings? ? lettings_logs_path : sales_logs_path
end
end
def get_next_incomplete_section(log)
log.form.subsections.find { |subsection| subsection.is_incomplete?(log) }
end
@ -43,6 +60,10 @@ module TasklistHelper
private
def breadcrumb_organisation(log)
log.owning_organisation || (log.managing_organisation if log.respond_to?(:managing_organisation))
end
def next_page_or_check_answers(subsection, log, current_user)
path = if subsection.is_started?(log)
"#{log.class.name.underscore}_#{subsection.id}_check_answers_path"

2
app/views/form/check_answers.html.erb

@ -1,6 +1,6 @@
<% content_for :title, "#{subsection.id.humanize} - Check your answers" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => url_for(@log.class),
breadcrumb_logs_title(@log, current_user) => breadcrumb_logs_link(@log, current_user),
"Log #{@log.id}" => url_for(@log),
subsection.label => "",
}) %>

16
app/views/locations/index.html.erb

@ -2,16 +2,22 @@
<% title = format_title(@searched, @scheme.service_name, current_user, item_label, @pagy.count, nil) %>
<% content_for :title, title %>
<% content_for :before_content do %>
<%= govuk_back_link(
href: "/schemes/#{@scheme.id}",
) %>
<% if current_user.support? %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Schemes (#{@scheme.owning_organisation.name})" => schemes_organisation_path(@scheme.owning_organisation),
content_for(:title) => scheme_path(@scheme),
"Locations" => "",
}) %>
<% else %>
<% content_for :before_content do %>
<%= govuk_back_link(href: scheme_path(@scheme)) %>
<% end %>
<% end %>
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
<div class="app-filter-layout" data-controller="filter-layout">
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id)) %>
<%= render partial: "locations/location_filters" %>
<div class="app-filter-layout__content">

2
app/views/logs/edit.html.erb

@ -1,6 +1,6 @@
<% content_for :title, "Log #{@log.id}" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Logs" => @log.lettings? ? lettings_logs_path : sales_logs_path,
breadcrumb_logs_title(@log, current_user) => breadcrumb_logs_link(@log, current_user),
content_for(:title) => "",
}) %>

2
app/views/logs/index.html.erb

@ -1,5 +1,5 @@
<% item_label = format_label(@pagy.count, "logs") %>
<% title = format_title(@searched, "Logs", current_user, item_label, @pagy.count, nil) %>
<% title = format_title(@searched, "#{log_type_for_controller(controller).capitalize} logs", current_user, item_label, @pagy.count, nil) %>
<% content_for :title, title %>

2
app/views/organisation_relationships/managing_agents.html.erb

@ -23,5 +23,5 @@
<% if @total_count != 0 %>
<%= render SearchComponent.new(current_user:, search_label: "Search for a managing agent", value: @searched) %>
<%= render partial: "organisation_relationships/managing_agent_list", locals: { index: @managing_agents, title: "Managing agents", pagy: @pagy, searched: @searched, item_label:, total_count: @total_count } %>
<%= render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "Managing agents" } %>
<%= render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "managing agents" } %>
<% end %>

4
app/views/organisations/data_sharing_agreement.html.erb

@ -1,5 +1,9 @@
<%= content_for :title, "Data sharing agreement" %>
<% content_for :before_content do %>
<%= govuk_back_link(href: :back) %>
<% end %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<h2 id="data-provider-organisation-and-department-for-levelling-up-housing-and-communities" class="govuk-heading-l">

18
app/views/organisations/logs.html.erb

@ -1,10 +1,17 @@
<% item_label = format_label(@pagy.count, "logs") %>
<% title = format_title(@searched, "Logs", current_user, item_label, @pagy.count, @organisation.name) %>
<% title = format_title(@searched, action_name.humanize, current_user, item_label, @pagy.count, @organisation.name) %>
<% content_for :title, title %>
<%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %>
<% if current_user.support? %>
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Logs</h2>
<% end %>
<%= render DataProtectionConfirmationBannerComponent.new(
user: current_user,
organisation: @organisation,
@ -16,19 +23,12 @@
<% end %>
<% end %>
<% if current_user.support? %>
<%= render SubNavigationComponent.new(
items: secondary_items(request.path, @organisation.id),
) %>
<h2 class="govuk-visually-hidden">Logs</h2>
<% end %>
<div class="app-filter-layout" data-controller="filter-layout">
<%= render partial: "logs/create_for_org_actions" %>
<%= render partial: "logs/log_filters" %>
<div class="app-filter-layout__content">
<%= render SearchComponent.new(current_user:, search_label: "Search by log ID, tenant code, property reference or postcode", value: @searched) %>
<%= render SearchComponent.new(current_user:, search_label: search_label_for_action(action_name), value: @searched) %>
<%= govuk_section_break(visible: true, size: "m") %>
<%= render partial: "logs/log_list",
locals: {

15
app/views/schemes/show.html.erb

@ -1,17 +1,22 @@
<% title = @scheme.service_name %>
<% content_for :title, title %>
<% content_for :before_content do %>
<%= govuk_back_link(
href: "/schemes",
) %>
<% if current_user.support? %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Schemes (#{@scheme.owning_organisation.name})" => schemes_organisation_path(@scheme.owning_organisation),
content_for(:title) => "",
}) %>
<% else %>
<% content_for :before_content do %>
<%= govuk_back_link(href: schemes_path) %>
<% end %>
<% end %>
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %>
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id)) %>
<h2 class="govuk-visually-hidden">Scheme</h2>
<%= govuk_inset_text(text: edit_scheme_text(@scheme, current_user)) %>

11
app/views/users/show.html.erb

@ -1,5 +1,16 @@
<% content_for :title, current_user == @user ? "Your account" : "#{@user.name.presence || @user.email}’s account" %>
<% if current_user.support? %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Users (#{@user.organisation.name})" => users_organisation_path(@user.organisation),
content_for(:title) => "",
}) %>
<% else %>
<% content_for :before_content do %>
<%= govuk_back_link(href: users_path) %>
<% end %>
<% end %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">

10
spec/features/lettings_log_spec.rb

@ -157,8 +157,8 @@ RSpec.describe "Lettings Log Features" do
it "has the correct breadcrumbs with the correct links" do
visit lettings_log_setup_check_answers_path(lettings_log)
breadcrumbs = page.find_all(".govuk-breadcrumbs__link")
expect(breadcrumbs.first.text).to eq "Logs"
expect(breadcrumbs.first[:href]).to eq lettings_logs_path
expect(breadcrumbs.first.text).to eq "Lettings logs (DLUHC)"
expect(breadcrumbs.first[:href]).to eq lettings_logs_organisation_path(lettings_log.owning_organisation)
expect(breadcrumbs[1].text).to eq "Log #{lettings_log.id}"
expect(breadcrumbs[1][:href]).to eq lettings_log_path(lettings_log)
end
@ -170,8 +170,8 @@ RSpec.describe "Lettings Log Features" do
it "has the correct breadcrumbs with the correct links" do
visit review_lettings_log_path(lettings_log)
breadcrumbs = page.find_all(".govuk-breadcrumbs__link")
expect(breadcrumbs.first.text).to eq "Logs"
expect(breadcrumbs.first[:href]).to eq lettings_logs_path
expect(breadcrumbs.first.text).to eq "Lettings logs (DLUHC)"
expect(breadcrumbs.first[:href]).to eq lettings_logs_organisation_path(lettings_log.owning_organisation)
expect(breadcrumbs[1].text).to eq "Log #{lettings_log.id}"
expect(breadcrumbs[1][:href]).to eq lettings_log_path(lettings_log)
end
@ -439,7 +439,7 @@ RSpec.describe "Lettings Log Features" do
before do
visit("/lettings-logs")
click_button("Create a new lettings log")
click_link("Logs")
find("a.govuk-breadcrumbs__link", text: "Lettings logs").click
end
it "navigates you to the lettings logs page" do

10
spec/features/sales_log_spec.rb

@ -22,7 +22,7 @@ RSpec.describe "Sales Log Features" do
context "when returning to the list of logs via breadcrumbs link" do
before do
click_button("Create a new sales log")
click_link("Logs")
find("a.govuk-breadcrumbs__link", text: "Sales logs").click
end
it "navigates you to the sales logs page" do
@ -164,8 +164,8 @@ RSpec.describe "Sales Log Features" do
it "has the correct breadcrumbs with the correct links" do
visit sales_log_setup_check_answers_path(sales_log.id)
breadcrumbs = page.find_all(".govuk-breadcrumbs__link")
expect(breadcrumbs.first.text).to eq "Logs"
expect(breadcrumbs.first[:href]).to eq sales_logs_path
expect(breadcrumbs.first.text).to eq "Sales logs (DLUHC)"
expect(breadcrumbs.first[:href]).to eq sales_logs_organisation_path(sales_log.owning_organisation)
expect(breadcrumbs[1].text).to eq "Log #{sales_log.id}"
expect(breadcrumbs[1][:href]).to eq sales_log_path(sales_log.id)
end
@ -175,8 +175,8 @@ RSpec.describe "Sales Log Features" do
it "has the correct breadcrumbs with the correct links" do
visit review_sales_log_path(sales_log.id, sales_log: true)
breadcrumbs = page.find_all(".govuk-breadcrumbs__link")
expect(breadcrumbs.first.text).to eq "Logs"
expect(breadcrumbs.first[:href]).to eq sales_logs_path
expect(breadcrumbs.first.text).to eq "Sales logs (DLUHC)"
expect(breadcrumbs.first[:href]).to eq sales_logs_organisation_path(sales_log.owning_organisation)
expect(breadcrumbs[1].text).to eq "Log #{sales_log.id}"
expect(breadcrumbs[1][:href]).to eq sales_log_path(sales_log.id)
end

27
spec/features/schemes_spec.rb

@ -173,6 +173,7 @@ RSpec.describe "Schemes scheme Features" do
context "when viewing individual scheme" do
let!(:schemes) { FactoryBot.create_list(:scheme, 5) }
let!(:same_organisation_schemes) { FactoryBot.create_list(:scheme, 5, owning_organisation: user.organisation) }
context "when I visit schemes page" do
before do
@ -180,22 +181,22 @@ RSpec.describe "Schemes scheme Features" do
end
context "when I click to see individual scheme" do
let(:scheme) { schemes.first }
let(:scheme) { same_organisation_schemes.first }
before do
click_link(scheme.service_name)
end
it "shows me details about the selected scheme" do
expect(page).to have_content(schemes.first.id_to_display)
expect(page).to have_content(schemes.first.service_name)
expect(page).to have_content(schemes.first.sensitive)
expect(page).to have_content(schemes.first.scheme_type)
expect(page).to have_content(schemes.first.registered_under_care_act)
expect(page).to have_content(schemes.first.primary_client_group)
expect(page).to have_content(schemes.first.secondary_client_group)
expect(page).to have_content(schemes.first.support_type)
expect(page).to have_content(schemes.first.intended_stay)
expect(page).to have_content(scheme.id_to_display)
expect(page).to have_content(scheme.service_name)
expect(page).to have_content(scheme.sensitive)
expect(page).to have_content(scheme.scheme_type)
expect(page).to have_content(scheme.registered_under_care_act)
expect(page).to have_content(scheme.primary_client_group)
expect(page).to have_content(scheme.secondary_client_group)
expect(page).to have_content(scheme.support_type)
expect(page).to have_content(scheme.intended_stay)
end
context "when I click to go back" do
@ -204,9 +205,9 @@ RSpec.describe "Schemes scheme Features" do
click_link(scheme.service_name)
end
it "shows list of links to schemes" do
click_on("Back")
schemes.each do |scheme|
it "shows list of links to the organisation's schemes" do
click_on("Schemes (DLUHC)")
same_organisation_schemes.each do |scheme|
expect(page).to have_link(scheme.service_name)
expect(page).to have_content(scheme.id_to_display)
expect(page).to have_content(scheme.locations&.count)

34
spec/helpers/navigation_items_helper_spec.rb

@ -15,7 +15,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Lettings logs", "/lettings-logs", true),
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -38,7 +38,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -57,7 +57,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -75,7 +75,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", true),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -93,7 +93,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -111,7 +111,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", true),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", true),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -129,7 +129,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -147,7 +147,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -165,7 +165,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", true),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -194,7 +194,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Lettings logs", "/lettings-logs", true),
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -217,7 +217,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About your organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -349,7 +349,7 @@ RSpec.describe NavigationItemsHelper do
it "returns navigation items with Schemes item set as current" do
expect(primary_items("/schemes/1", current_user)).to eq(expected_navigation_items)
expect(scheme_items("/schemes/1", 1, "Locations")).to eq(expected_scheme_items)
expect(scheme_items("/schemes/1", 1)).to eq(expected_scheme_items)
end
end
@ -373,7 +373,7 @@ RSpec.describe NavigationItemsHelper do
it "returns navigation items with Schemes item set as current" do
expect(primary_items("/schemes/1/locations", current_user)).to eq(expected_navigation_items)
expect(scheme_items("/schemes/1/locations", 1, "Locations")).to eq(expected_scheme_items)
expect(scheme_items("/schemes/1/locations", 1)).to eq(expected_scheme_items)
end
end
@ -396,7 +396,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/organisations/#{current_user.organisation.id}/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/organisations/#{current_user.organisation.id}/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -426,7 +426,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/organisations/#{current_user.organisation.id}/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/organisations/#{current_user.organisation.id}/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -456,7 +456,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/organisations/#{current_user.organisation.id}/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/organisations/#{current_user.organisation.id}/schemes", true),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}/details", false),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]
@ -486,7 +486,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Sales logs", "/organisations/#{current_user.organisation.id}/sales-logs", false),
NavigationItemsHelper::NavigationItem.new("Schemes", "/organisations/#{current_user.organisation.id}/schemes", false),
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}", true),
NavigationItemsHelper::NavigationItem.new("About this organisation", "/organisations/#{current_user.organisation.id}/details", true),
NavigationItemsHelper::NavigationItem.new("Stock owners", "/organisations/#{current_user.organisation.id}/stock-owners", false),
NavigationItemsHelper::NavigationItem.new("Managing agents", "/organisations/#{current_user.organisation.id}/managing-agents", false),
]

14
spec/requests/lettings_logs_controller_spec.rb

@ -345,7 +345,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "page has correct title" do
get "/lettings-logs", headers:, params: {}
expect(page).to have_title("Logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
@ -652,7 +652,7 @@ RSpec.describe LettingsLogsController, type: :request do
it "has search results in the title" do
get "/lettings-logs?search=#{log_to_search.id}", headers:, params: {}
expect(page).to have_title("Logs (1 logs matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs (1 logs matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
it "shows lettings logs matching the id" do
@ -716,12 +716,12 @@ RSpec.describe LettingsLogsController, type: :request do
it "has title with pagination details for page 1" do
get "/lettings-logs?search=#{logs[0].postcode_full}", headers:, params: {}
expect(page).to have_title("Logs (#{logs.count} logs matching ‘#{postcode}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs (#{logs.count} logs matching ‘#{postcode}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
it "has title with pagination details for page 2" do
get "/lettings-logs?search=#{logs[0].postcode_full}&page=2", headers:, params: {}
expect(page).to have_title("Logs (#{logs.count} logs matching ‘#{postcode}’) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs (#{logs.count} logs matching ‘#{postcode}’) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
@ -801,7 +801,7 @@ RSpec.describe LettingsLogsController, type: :request do
end
it "does not have pagination in the title" do
expect(page).to have_title("Logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
it "shows the CSV download link" do
@ -872,7 +872,7 @@ RSpec.describe LettingsLogsController, type: :request do
end
it "has pagination in the title" do
expect(page).to have_title("Logs (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
@ -897,7 +897,7 @@ RSpec.describe LettingsLogsController, type: :request do
end
it "has pagination in the title" do
expect(page).to have_title("Logs (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Lettings logs (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
end

10
spec/requests/sales_logs_controller_spec.rb

@ -254,7 +254,7 @@ RSpec.describe SalesLogsController, type: :request do
it "page has correct title" do
get "/sales-logs", headers: headers, params: {}
expect(page).to have_title("Logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Sales logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
it "does not show CSV download links" do
@ -611,7 +611,7 @@ RSpec.describe SalesLogsController, type: :request do
it "has search results in the title" do
get "/sales-logs?search=#{log_to_search.id}", headers: headers, params: {}
expect(page).to have_title("Logs (1 logs matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Sales logs (1 logs matching ‘#{log_to_search.id}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
it "shows sales logs matching the id" do
@ -706,7 +706,7 @@ RSpec.describe SalesLogsController, type: :request do
end
it "does not have pagination in the title" do
expect(page).to have_title("Logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Sales logs - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
it "does not show the organisation filter" do
@ -736,7 +736,7 @@ RSpec.describe SalesLogsController, type: :request do
end
it "has pagination in the title" do
expect(page).to have_title("Logs (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Sales logs (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
@ -761,7 +761,7 @@ RSpec.describe SalesLogsController, type: :request do
end
it "has pagination in the title" do
expect(page).to have_title("Logs (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title("Sales logs (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
end
end

Loading…
Cancel
Save