From 2591b9fea7ef0afaaba14f3e04e10c4cf0efc194 Mon Sep 17 00:00:00 2001 From: Jon Kirwan <87758239+jon-kirwan@users.noreply.github.com> Date: Mon, 15 Aug 2022 12:56:18 +0100 Subject: [PATCH] Implement the content list component --- app/presenters/content_item/contents_list.rb | 8 +++++ app/presenters/content_item/manual.rb | 14 +-------- app/presenters/content_item/manual_section.rb | 18 +++++++++++ app/presenters/content_item/manual_updates.rb | 9 ++++++ .../hmrc_manual_section_presenter.rb | 7 ++++- app/presenters/manual_section_presenter.rb | 1 + .../content_items/manual_section.html.erb | 4 +++ config/locales/ar.yml | 2 ++ config/locales/az.yml | 2 ++ config/locales/be.yml | 2 ++ config/locales/bg.yml | 2 ++ config/locales/bn.yml | 2 ++ config/locales/cs.yml | 2 ++ config/locales/cy.yml | 2 ++ config/locales/da.yml | 2 ++ config/locales/de.yml | 2 ++ config/locales/dr.yml | 2 ++ config/locales/el.yml | 2 ++ config/locales/en.yml | 2 ++ config/locales/es-419.yml | 2 ++ config/locales/es.yml | 2 ++ config/locales/et.yml | 2 ++ config/locales/fa.yml | 2 ++ config/locales/fi.yml | 2 ++ config/locales/fr.yml | 2 ++ config/locales/gd.yml | 2 ++ config/locales/gu.yml | 2 ++ config/locales/he.yml | 2 ++ config/locales/hi.yml | 2 ++ config/locales/hr.yml | 2 ++ config/locales/hu.yml | 2 ++ config/locales/hy.yml | 2 ++ config/locales/id.yml | 2 ++ config/locales/is.yml | 2 ++ config/locales/it.yml | 2 ++ config/locales/ja.yml | 2 ++ config/locales/ka.yml | 2 ++ config/locales/kk.yml | 2 ++ config/locales/ko.yml | 2 ++ config/locales/lt.yml | 2 ++ config/locales/lv.yml | 2 ++ config/locales/ms.yml | 2 ++ config/locales/mt.yml | 2 ++ config/locales/ne.yml | 2 ++ config/locales/nl.yml | 2 ++ config/locales/no.yml | 2 ++ config/locales/pa-pk.yml | 2 ++ config/locales/pa.yml | 2 ++ config/locales/pl.yml | 2 ++ config/locales/ps.yml | 2 ++ config/locales/pt.yml | 2 ++ config/locales/ro.yml | 2 ++ config/locales/ru.yml | 2 ++ config/locales/si.yml | 2 ++ config/locales/sk.yml | 2 ++ config/locales/sl.yml | 2 ++ config/locales/so.yml | 2 ++ config/locales/sq.yml | 2 ++ config/locales/sr.yml | 2 ++ config/locales/sv.yml | 2 ++ config/locales/sw.yml | 2 ++ config/locales/ta.yml | 2 ++ config/locales/th.yml | 2 ++ config/locales/tk.yml | 2 ++ config/locales/tr.yml | 2 ++ config/locales/uk.yml | 2 ++ config/locales/ur.yml | 2 ++ config/locales/uz.yml | 2 ++ config/locales/vi.yml | 2 ++ config/locales/yi.yml | 2 ++ config/locales/zh-hk.yml | 2 ++ config/locales/zh-tw.yml | 2 ++ config/locales/zh.yml | 2 ++ test/integration/manual_section_test.rb | 13 ++++++++ .../content_item/contents_list_test.rb | 31 +++++++++++++++++++ .../content_item/manual_section_test.rb | 28 +++++++++++++++++ test/presenters/content_item/manual_test.rb | 12 +------ 77 files changed, 252 insertions(+), 25 deletions(-) diff --git a/app/presenters/content_item/contents_list.rb b/app/presenters/content_item/contents_list.rb index c420fa877..85cbfb70d 100644 --- a/app/presenters/content_item/contents_list.rb +++ b/app/presenters/content_item/contents_list.rb @@ -19,6 +19,7 @@ def contents_items end def show_contents_list? + return false if exclude_contents_list_for_manual_section? return false if contents_items.count < 2 return true if contents_items.count > 2 return false if no_first_item? @@ -110,5 +111,12 @@ def first_item def no_first_item? first_item.nil? end + + def exclude_contents_list_for_manual_section? + # MOJ require contents lists for manual section pages. + + moj_content = content_item.dig("links", "organisations", 0, "content_id") == "dcc907d6-433c-42df-9ffb-d9c68be5dc4d" + document_type == "manual_section" && !moj_content + end end end diff --git a/app/presenters/content_item/manual.rb b/app/presenters/content_item/manual.rb index 2b9a41893..1963c660c 100644 --- a/app/presenters/content_item/manual.rb +++ b/app/presenters/content_item/manual.rb @@ -16,20 +16,8 @@ def page_title alias_method :manual_page_title, :page_title def breadcrumbs - crumbs = [] - - if view_context.request.path == base_path - crumbs.push({ - title: I18n.t("manuals.breadcrumb_contents"), - }) - else - crumbs.push({ - title: I18n.t("manuals.breadcrumb_contents"), - url: base_path, - }) - end + [{ title: I18n.t("manuals.breadcrumb_contents") }] end - alias_method :manual_breadcrumbs, :breadcrumbs def section_groups content_item.dig("details", "child_section_groups") || [] diff --git a/app/presenters/content_item/manual_section.rb b/app/presenters/content_item/manual_section.rb index 938a27eba..162cc5253 100644 --- a/app/presenters/content_item/manual_section.rb +++ b/app/presenters/content_item/manual_section.rb @@ -15,6 +15,24 @@ def document_heading document_heading << content_item["title"] if content_item["title"] end + def breadcrumbs + if show_contents_list? + [ + { + title: I18n.t("manuals.contents_list_breadcrumb_contents"), + url: base_path, + }, + ] + else + [ + { + title: I18n.t("manuals.breadcrumb_contents"), + url: base_path, + }, + ] + end + end + def breadcrumb details["section_id"] || title end diff --git a/app/presenters/content_item/manual_updates.rb b/app/presenters/content_item/manual_updates.rb index 2015c7535..bbd959ba6 100644 --- a/app/presenters/content_item/manual_updates.rb +++ b/app/presenters/content_item/manual_updates.rb @@ -4,6 +4,15 @@ def page_title I18n.t("manuals.updates_page_title", title: manual_page_title) end + def breadcrumbs + [ + { + title: I18n.t("manuals.breadcrumb_contents"), + url: base_path, + }, + ] + end + def description I18n.t("manuals.updates_description", title: manual_page_title) end diff --git a/app/presenters/hmrc_manual_section_presenter.rb b/app/presenters/hmrc_manual_section_presenter.rb index 47d72df00..26d264025 100644 --- a/app/presenters/hmrc_manual_section_presenter.rb +++ b/app/presenters/hmrc_manual_section_presenter.rb @@ -8,7 +8,12 @@ def base_path end def breadcrumbs - crumbs = manual_breadcrumbs.dup + crumbs = [ + { + title: I18n.t("manuals.breadcrumb_contents"), + url: base_path, + }, + ] return crumbs if content_item_breadcrumbs.blank? diff --git a/app/presenters/manual_section_presenter.rb b/app/presenters/manual_section_presenter.rb index 78bda4b5f..f22ba5fd1 100644 --- a/app/presenters/manual_section_presenter.rb +++ b/app/presenters/manual_section_presenter.rb @@ -1,6 +1,7 @@ class ManualSectionPresenter < ContentItemPresenter include ContentItem::Metadata include ContentItem::Manual + include ContentItem::ContentsList include ContentItem::ManualSection def base_path diff --git a/app/views/content_items/manual_section.html.erb b/app/views/content_items/manual_section.html.erb index 039cd31d7..95ee87552 100644 --- a/app/views/content_items/manual_section.html.erb +++ b/app/views/content_items/manual_section.html.erb @@ -3,6 +3,10 @@ content_item: @content_item, heading_level: 1, margin_bottom: 6, } %> + <%= render "govuk_publishing_components/components/contents_list", { + aria_label: t("manuals.pages_in_manual_section"), contents: @content_item.contents, underline_links: true + } %> +
diff --git a/config/locales/ar.yml b/config/locales/ar.yml index 0f1d81321..8f102b21d 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -732,9 +732,11 @@ ar: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/az.yml b/config/locales/az.yml index 323b0898c..509f15950 100644 --- a/config/locales/az.yml +++ b/config/locales/az.yml @@ -432,9 +432,11 @@ az: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/be.yml b/config/locales/be.yml index a5447a9d2..d55826934 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -582,9 +582,11 @@ be: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/bg.yml b/config/locales/bg.yml index c9e5ca93e..63e8fb83f 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -432,9 +432,11 @@ bg: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/bn.yml b/config/locales/bn.yml index 9a605a743..9a0448682 100644 --- a/config/locales/bn.yml +++ b/config/locales/bn.yml @@ -432,9 +432,11 @@ bn: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/cs.yml b/config/locales/cs.yml index b82480cca..06dfc6212 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -507,9 +507,11 @@ cs: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/cy.yml b/config/locales/cy.yml index d2c220f35..2d45298c2 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -732,9 +732,11 @@ cy: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/da.yml b/config/locales/da.yml index dd87a8191..4c1440fd4 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -444,9 +444,11 @@ da: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/de.yml b/config/locales/de.yml index ed6a2cfd4..8b7d0cf43 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -432,9 +432,11 @@ de: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/dr.yml b/config/locales/dr.yml index 6f17bc08b..e091fcb74 100644 --- a/config/locales/dr.yml +++ b/config/locales/dr.yml @@ -435,9 +435,11 @@ dr: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/el.yml b/config/locales/el.yml index 36854dca4..1a54cd15d 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -432,9 +432,11 @@ el: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/en.yml b/config/locales/en.yml index 673c5e679..2c20b1a31 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -432,9 +432,11 @@ en: zh-tw: Traditional Chinese manuals: breadcrumb_contents: Contents + contents_list_breadcrumb_contents: Manual homepage hmrc_manual_type: HMRC internal manual hmrc_title: "%{title}HMRC internal manual" next_page: Next page + pages_in_manual_section: Manual section pages previous_page: Previous page search_this_manual: Search this manual see_all_updates: see all updates diff --git a/config/locales/es-419.yml b/config/locales/es-419.yml index 777e9028e..fcc8c5941 100644 --- a/config/locales/es-419.yml +++ b/config/locales/es-419.yml @@ -432,9 +432,11 @@ es-419: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/es.yml b/config/locales/es.yml index 029b5bf20..b1703136a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -432,9 +432,11 @@ es: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/et.yml b/config/locales/et.yml index cbb6b6b28..ff41237f2 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -432,9 +432,11 @@ et: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/fa.yml b/config/locales/fa.yml index c895c60e7..3faee9be7 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -432,9 +432,11 @@ fa: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 7f2b861fa..33538315c 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -432,9 +432,11 @@ fi: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e0fc41341..d08da08df 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -432,9 +432,11 @@ fr: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/gd.yml b/config/locales/gd.yml index 1d0471afc..b45a5ad05 100644 --- a/config/locales/gd.yml +++ b/config/locales/gd.yml @@ -582,9 +582,11 @@ gd: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/gu.yml b/config/locales/gu.yml index 3b28dc4c6..def94b029 100644 --- a/config/locales/gu.yml +++ b/config/locales/gu.yml @@ -432,9 +432,11 @@ gu: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/he.yml b/config/locales/he.yml index 17d0fd456..b130e1305 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -432,9 +432,11 @@ he: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/hi.yml b/config/locales/hi.yml index 88f28c799..5baedc5d9 100644 --- a/config/locales/hi.yml +++ b/config/locales/hi.yml @@ -432,9 +432,11 @@ hi: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 4fcfe99aa..0aec67d24 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -507,9 +507,11 @@ hr: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index e25a67e11..0c83b1b70 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -432,9 +432,11 @@ hu: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/hy.yml b/config/locales/hy.yml index 60c015d05..12f0b2985 100644 --- a/config/locales/hy.yml +++ b/config/locales/hy.yml @@ -432,9 +432,11 @@ hy: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/id.yml b/config/locales/id.yml index aedb771fe..f98a8beae 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -357,9 +357,11 @@ id: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/is.yml b/config/locales/is.yml index d2a97e26b..dca5bacbb 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -432,9 +432,11 @@ is: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/it.yml b/config/locales/it.yml index 9fab30f93..e58d8151d 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -432,9 +432,11 @@ it: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 28d76c9a6..b0b5fba7b 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -357,9 +357,11 @@ ja: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ka.yml b/config/locales/ka.yml index e08180f18..efee18299 100644 --- a/config/locales/ka.yml +++ b/config/locales/ka.yml @@ -432,9 +432,11 @@ ka: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/kk.yml b/config/locales/kk.yml index e09da1c23..bafc72138 100644 --- a/config/locales/kk.yml +++ b/config/locales/kk.yml @@ -432,9 +432,11 @@ kk: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 42f599fe8..d0f2568e9 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -357,9 +357,11 @@ ko: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/lt.yml b/config/locales/lt.yml index a80c78cd4..8edf5b9b4 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -507,9 +507,11 @@ lt: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/lv.yml b/config/locales/lv.yml index c8fd27b7c..ffb72dadb 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -432,9 +432,11 @@ lv: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ms.yml b/config/locales/ms.yml index 348df2d53..4acd3711a 100644 --- a/config/locales/ms.yml +++ b/config/locales/ms.yml @@ -357,9 +357,11 @@ ms: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/mt.yml b/config/locales/mt.yml index 3ba35d8fd..aebede272 100644 --- a/config/locales/mt.yml +++ b/config/locales/mt.yml @@ -582,9 +582,11 @@ mt: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ne.yml b/config/locales/ne.yml index 564e40364..3b9dc2613 100644 --- a/config/locales/ne.yml +++ b/config/locales/ne.yml @@ -432,9 +432,11 @@ ne: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 18f1bfefb..706c29cf6 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -432,9 +432,11 @@ nl: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/no.yml b/config/locales/no.yml index 6494869e2..310eb4f34 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -432,9 +432,11 @@ zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/pa-pk.yml b/config/locales/pa-pk.yml index a18b3d0e8..c547b75ff 100644 --- a/config/locales/pa-pk.yml +++ b/config/locales/pa-pk.yml @@ -432,9 +432,11 @@ pa-pk: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/pa.yml b/config/locales/pa.yml index c75f71e34..dbd50d0f9 100644 --- a/config/locales/pa.yml +++ b/config/locales/pa.yml @@ -432,9 +432,11 @@ pa: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 286b652eb..8e3d12912 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -582,9 +582,11 @@ pl: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ps.yml b/config/locales/ps.yml index 20f311fa0..bb0c5022f 100644 --- a/config/locales/ps.yml +++ b/config/locales/ps.yml @@ -432,9 +432,11 @@ ps: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 3275af152..ffbb885c3 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -432,9 +432,11 @@ pt: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 5363ff9a3..ad4bb6124 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -507,9 +507,11 @@ ro: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 46efa6d63..df3d88f0a 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -582,9 +582,11 @@ ru: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/si.yml b/config/locales/si.yml index e522348b0..4698bea0e 100644 --- a/config/locales/si.yml +++ b/config/locales/si.yml @@ -432,9 +432,11 @@ si: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 4585fdc27..d733b3e41 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -507,9 +507,11 @@ sk: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 1570f839f..c23a1c99d 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -582,9 +582,11 @@ sl: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/so.yml b/config/locales/so.yml index 98bbcd541..d5cd0fa8c 100644 --- a/config/locales/so.yml +++ b/config/locales/so.yml @@ -432,9 +432,11 @@ so: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/sq.yml b/config/locales/sq.yml index e603de9e7..dae60a611 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -432,9 +432,11 @@ sq: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 546d4f9a1..7c2364555 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -507,9 +507,11 @@ sr: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 9c11f1e58..215e229d2 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -432,9 +432,11 @@ sv: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/sw.yml b/config/locales/sw.yml index f2e9ecf8f..27dd3db77 100644 --- a/config/locales/sw.yml +++ b/config/locales/sw.yml @@ -432,9 +432,11 @@ sw: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ta.yml b/config/locales/ta.yml index da7c564ea..5add908a8 100644 --- a/config/locales/ta.yml +++ b/config/locales/ta.yml @@ -432,9 +432,11 @@ ta: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/th.yml b/config/locales/th.yml index bf0b6cb69..c25afdee6 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -357,9 +357,11 @@ th: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/tk.yml b/config/locales/tk.yml index 8be49cec6..58d1311f7 100644 --- a/config/locales/tk.yml +++ b/config/locales/tk.yml @@ -432,9 +432,11 @@ tk: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 50dfdbabc..d0ea35f14 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -432,9 +432,11 @@ tr: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 9b66f4dae..f0d5f8780 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -582,9 +582,11 @@ uk: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/ur.yml b/config/locales/ur.yml index 51b53e70a..ab844d0fb 100644 --- a/config/locales/ur.yml +++ b/config/locales/ur.yml @@ -432,9 +432,11 @@ ur: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/uz.yml b/config/locales/uz.yml index 8c9958272..883892170 100644 --- a/config/locales/uz.yml +++ b/config/locales/uz.yml @@ -432,9 +432,11 @@ uz: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 6ba27c646..2a01f9d7b 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -357,9 +357,11 @@ vi: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/yi.yml b/config/locales/yi.yml index 9eef342c2..3146c4433 100644 --- a/config/locales/yi.yml +++ b/config/locales/yi.yml @@ -432,9 +432,11 @@ yi: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/zh-hk.yml b/config/locales/zh-hk.yml index 05053e94b..8293ebd6e 100644 --- a/config/locales/zh-hk.yml +++ b/config/locales/zh-hk.yml @@ -432,9 +432,11 @@ zh-hk: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/zh-tw.yml b/config/locales/zh-tw.yml index 3b4695412..68f38e9f6 100644 --- a/config/locales/zh-tw.yml +++ b/config/locales/zh-tw.yml @@ -432,9 +432,11 @@ zh-tw: zh-tw: 繁體中文 manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/config/locales/zh.yml b/config/locales/zh.yml index f500bba36..39ac020b2 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -357,9 +357,11 @@ zh: zh-tw: manuals: breadcrumb_contents: + contents_list_breadcrumb_contents: hmrc_manual_type: hmrc_title: next_page: + pages_in_manual_section: previous_page: search_this_manual: see_all_updates: diff --git a/test/integration/manual_section_test.rb b/test/integration/manual_section_test.rb index 7a1d46dfc..0502cf7ee 100644 --- a/test/integration/manual_section_test.rb +++ b/test/integration/manual_section_test.rb @@ -84,6 +84,19 @@ class ManualSectionTest < ActionDispatch::IntegrationTest end end + test "renders content lists if published by MOJ" do + content_item = get_content_example("what-is-content-design") + organisations = { "organisations" => [{ "content_id" => "dcc907d6-433c-42df-9ffb-d9c68be5dc4d" }] } + content_item["links"] = content_item["links"].merge(organisations) + + setup_and_visit_manual_section(content_item) + + assert_has_contents_list([ + { text: "Designing content, not creating copy", id: "designing-content-not-creating-copy" }, + { text: "Content design always starts with user needs", id: "content-design-always-starts-with-user-needs" }, + ]) + end + def setup_and_visit_manual_section(content_item = get_content_example("what-is-content-design")) @manual = get_content_example_by_schema_and_name("manual", "content-design") @content_item = content_item diff --git a/test/presenters/content_item/contents_list_test.rb b/test/presenters/content_item/contents_list_test.rb index 144f2a59c..f84048c39 100644 --- a/test/presenters/content_item/contents_list_test.rb +++ b/test/presenters/content_item/contents_list_test.rb @@ -2,7 +2,20 @@ class ContentItemContentsListTest < ActiveSupport::TestCase def setup + content_item = { + "title" => "thing", + "document_type" => "manual_section", + "links" => { + "organisations" => [ + { + "content_id" => "dcc907d6-433c-42df-9ffb-d9c68be5dc4d", + }, + ], + }, + } @contents_list = Object.new + @contents_list.stubs(:content_item).returns(content_item) + @contents_list.stubs(:document_type).returns(content_item["document_type"]) @contents_list.stubs(:view_context) .returns(ApplicationController.new.view_context) @contents_list.extend(ContentItem::ContentsList) @@ -95,6 +108,24 @@ def body assert @contents_list.show_contents_list? end + test "#show_contents_list? returns false if the content item is a manual section but excluded from displaying content lists" do + content_item = { + "title" => "thing", + "document_type" => "manual_section", + "links" => { + "organisations" => [ + { + "content_id" => "91cd6143-69d5-4f27-99ff-a52fb0d51c74", + }, + ], + }, + } + + @contents_list.stubs(:content_item).returns(content_item) + @contents_list.stubs(:document_type).returns(content_item["document_type"]) + assert_not @contents_list.show_contents_list? + end + test "#show_contents_list? returns true if number of contents items is 2 and the first item's character count is above 415 including a list" do class << @contents_list def body diff --git a/test/presenters/content_item/manual_section_test.rb b/test/presenters/content_item/manual_section_test.rb index 8dbfe3ad9..85787f86e 100644 --- a/test/presenters/content_item/manual_section_test.rb +++ b/test/presenters/content_item/manual_section_test.rb @@ -34,6 +34,34 @@ def initialize assert_equal(%w[ADML1000 manualsectiontest], item.document_heading) end + test "returns breadcrumbs when showing contents list" do + item = DummyContentItem.new + item.stubs(:show_contents_list?).returns(true) + + breadcrumbs = [ + { + title: I18n.t("manuals.contents_list_breadcrumb_contents"), + url: item.base_path, + }, + ] + + assert_equal(breadcrumbs, item.breadcrumbs) + end + + test "returns breadcrumbs when not showing contents list" do + item = DummyContentItem.new + item.stubs(:show_contents_list?).returns(false) + + breadcrumbs = [ + { + title: I18n.t("manuals.breadcrumb_contents"), + url: item.base_path, + }, + ] + + assert_equal(breadcrumbs, item.breadcrumbs) + end + test "returns breadcrumb when section_id is present" do item = DummyContentItem.new diff --git a/test/presenters/content_item/manual_test.rb b/test/presenters/content_item/manual_test.rb index f0ac8f35b..589a5794b 100644 --- a/test/presenters/content_item/manual_test.rb +++ b/test/presenters/content_item/manual_test.rb @@ -41,22 +41,12 @@ def initialize(schema_name = "manual") assert_equal "#{item.title} - HMRC internal manual", item.page_title end - test "returns breadcrumbs when the base_path is equal to the request path" do + test "returns breadcrumbs" do item = DummyContentItem.new - item.view_context.stubs(:request) - .returns(ActionDispatch::TestRequest.create("PATH_INFO" => item.base_path)) assert_equal [{ title: I18n.t("manuals.breadcrumb_contents") }], item.breadcrumbs end - test "returns breadcrumbs when the base_path is not equal to the request path" do - item = DummyContentItem.new - item.view_context.stubs(:request) - .returns(ActionDispatch::TestRequest.create("PATH_INFO" => "/some/other/base_path")) - - assert_equal [{ title: I18n.t("manuals.breadcrumb_contents"), url: item.base_path }], item.breadcrumbs - end - test "returns section groups" do item = DummyContentItem.new