From ecdc4d99c5d6d730e5484a335272c38fb4265f60 Mon Sep 17 00:00:00 2001
From: natdeanlewissoftwire
<94526761+natdeanlewissoftwire@users.noreply.github.com>
Date: Wed, 18 Jan 2023 11:20:07 +0000
Subject: [PATCH] CLDC-1726 Update scheme and location display pages (#1190)
* feat: update scheme and log displays
* test: update tests
* test: update tests
---
app/helpers/tab_nav_helper.rb | 4 ++--
app/views/locations/index.html.erb | 4 ++++
spec/features/schemes_spec.rb | 10 ++++++----
spec/helpers/tab_nav_helper_spec.rb | 4 ++--
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/app/helpers/tab_nav_helper.rb b/app/helpers/tab_nav_helper.rb
index 3c61c9de0..801560b91 100644
--- a/app/helpers/tab_nav_helper.rb
+++ b/app/helpers/tab_nav_helper.rb
@@ -8,13 +8,13 @@ module TabNavHelper
def location_cell_postcode(location, link)
link_text = location.postcode || "Add postcode"
- [govuk_link_to(link_text, link, method: :patch), "Location #{location.name}"].join("\n")
+ [govuk_link_to(link_text, link, method: :patch), "Location"].join("\n")
end
def scheme_cell(scheme)
link_text = scheme.service_name
link = scheme.confirmed? ? scheme : scheme_check_answers_path(scheme)
- [govuk_link_to(link_text, link), "Scheme #{scheme.primary_client_group}"].join("\n")
+ [govuk_link_to(link_text, link), "Scheme"].join("\n")
end
def org_cell(user)
diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb
index 5040120d0..469768b11 100644
--- a/app/views/locations/index.html.erb
+++ b/app/views/locations/index.html.erb
@@ -39,6 +39,9 @@
<% row.cell(header: true, text: "Postcode", html_attributes: {
scope: "col",
}) %>
+ <% row.cell(header: true, text: "Name", html_attributes: {
+ scope: "col",
+ }) %>
<% row.cell(header: true, text: "Location code", html_attributes: {
scope: "col",
}) %>
@@ -55,6 +58,7 @@
else
location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location)
end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
+ <% row.cell(text: location.name) %>
<% row.cell(text: location.id) %>
<% row.cell(text: status_tag(location.status)) %>
<% end %>
diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb
index c51a5eea5..fefa3ea56 100644
--- a/spec/features/schemes_spec.rb
+++ b/spec/features/schemes_spec.rb
@@ -101,9 +101,9 @@ RSpec.describe "Schemes scheme Features" do
it "shows a list of schemes" do
schemes.each do |scheme|
- expect(page).to have_content(scheme.id)
expect(page).to have_link(scheme.service_name)
- expect(page).to have_content(scheme.primary_client_group)
+ expect(page).to have_content(scheme.id_to_display)
+ expect(page).to have_content(scheme.locations&.count)
end
end
@@ -175,7 +175,8 @@ RSpec.describe "Schemes scheme Features" do
click_on("Back")
schemes.each do |scheme|
expect(page).to have_link(scheme.service_name)
- expect(page).to have_content(scheme.primary_client_group)
+ expect(page).to have_content(scheme.id_to_display)
+ expect(page).to have_content(scheme.locations&.count)
end
end
end
@@ -671,7 +672,8 @@ RSpec.describe "Schemes scheme Features" do
it "shows list of links to schemes" do
schemes.each do |scheme|
expect(page).to have_link(scheme.service_name)
- expect(page).to have_content(scheme.primary_client_group)
+ expect(page).to have_content(scheme.id_to_display)
+ expect(page).to have_content(scheme.locations&.count)
end
end
diff --git a/spec/helpers/tab_nav_helper_spec.rb b/spec/helpers/tab_nav_helper_spec.rb
index b73200c4a..b2273aa11 100644
--- a/spec/helpers/tab_nav_helper_spec.rb
+++ b/spec/helpers/tab_nav_helper_spec.rb
@@ -23,14 +23,14 @@ RSpec.describe TabNavHelper do
describe "#location_cell" do
it "returns the location link to the postcode with optional name" do
link = "/schemes/#{location.scheme.id}/locations/#{location.id}/edit"
- expected_html = "#{location.postcode}\nLocation #{location.name}"
+ expected_html = "#{location.postcode}\nLocation"
expect(location_cell_postcode(location, link)).to match(expected_html)
end
end
describe "#scheme_cell" do
it "returns the scheme link service name and primary user group separated by a newline character" do
- expected_html = "#{scheme.service_name}\nScheme #{scheme.primary_client_group}"
+ expected_html = "#{scheme.service_name}\nScheme"
expect(scheme_cell(scheme)).to match(expected_html)
end
end