From 674e4cce9c3d907a84cc9bd6b9e54ab2a47e05aa Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 14 Jun 2022 13:10:12 +0100 Subject: [PATCH] links on the page --- app/helpers/navigation_items_helper.rb | 7 +++++++ app/views/schemes/show.html.erb | 4 ++++ spec/features/schemes_spec.rb | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/helpers/navigation_items_helper.rb b/app/helpers/navigation_items_helper.rb index 369428053..a463389d6 100644 --- a/app/helpers/navigation_items_helper.rb +++ b/app/helpers/navigation_items_helper.rb @@ -34,6 +34,13 @@ module NavigationItemsHelper ] end + def scheme_items(path, current_scheme_id) + [ + NavigationItem.new("Scheme", "/supported-housing/#{current_scheme_id}", true), + NavigationItem.new("Locations", "/supported-housing/#{current_scheme_id}/locations", false), + ] + end + private def logs_current?(path) diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index bb883d0e9..2e7ca22d1 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -3,6 +3,10 @@ <%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> +<%= render SubNavigationComponent.new( + items: scheme_items(request.path, @scheme.id), +) %> +
<%= govuk_summary_list do |summary_list| %> diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 09b9927df..a09dfe291 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -130,8 +130,8 @@ RSpec.describe "Supported housing scheme Features" do end it "shows service and locations tab" do - expect(page).to have_content("Service") - expect(page).to have_content("locations") + expect(page).to have_link("Service") + expect(page).to have_link("#{schemes.count} locations") end end end