From 773cab76a4102c1449e6d381e7541b4a6377adf7 Mon Sep 17 00:00:00 2001 From: Keith Lawrence Date: Mon, 18 Jul 2022 14:50:11 +0100 Subject: [PATCH] Simplify HRMC rendering with new schema data --- app/presenters/content_item/manual_section.rb | 1 - app/presenters/hmrc_manual_section_presenter.rb | 9 ++++----- test/presenters/hmrc_manual_section_presenter_test.rb | 5 +++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/presenters/content_item/manual_section.rb b/app/presenters/content_item/manual_section.rb index ab8c2c2ed..d67b2061f 100644 --- a/app/presenters/content_item/manual_section.rb +++ b/app/presenters/content_item/manual_section.rb @@ -21,7 +21,6 @@ def breadcrumb def manual_content_item # TODO: Add the same tagging to a normal section as a manual for contextual breadcrumbs - # TODO: Add the manual title to the HMRC section content item and then we can remove this request (manual_content_item) # TODO: Add the manual published / public updated at to both manual sections (normal and HMRC) @manual_content_item ||= Services.content_store.content_item(base_path) end diff --git a/app/presenters/hmrc_manual_section_presenter.rb b/app/presenters/hmrc_manual_section_presenter.rb index 6e4654555..db2e1b16c 100644 --- a/app/presenters/hmrc_manual_section_presenter.rb +++ b/app/presenters/hmrc_manual_section_presenter.rb @@ -7,6 +7,10 @@ def base_path details["manual"]["base_path"] end + def title + details["manual"]["title"] + end + def breadcrumbs crumbs = manual_breadcrumbs.dup @@ -81,11 +85,6 @@ def adjacent_siblings [before.try(:last), after.try(:first)] end - def manual - # TODO: Add the manual title to the HMRC section content item and then we can remove this request (manual_content_item) - parent_base_path == base_path ? parent_for_section : manual_content_item - end - def parent_base_path content_item_breadcrumbs.present? ? content_item_breadcrumbs.last["base_path"] : base_path end diff --git a/test/presenters/hmrc_manual_section_presenter_test.rb b/test/presenters/hmrc_manual_section_presenter_test.rb index 151cbf248..44a111460 100644 --- a/test/presenters/hmrc_manual_section_presenter_test.rb +++ b/test/presenters/hmrc_manual_section_presenter_test.rb @@ -33,6 +33,11 @@ class PresentedHmrcManualSectionTest < HmrcManualSectionPresenterTestCase assert_equal manual["base_path"], presented_manual_section.base_path end + test "presents manual title" do + manual = schema_item("vatgpb2000")["details"]["manual"] + assert_equal manual["title"], presented_manual_section.title + end + test "presents basic breadcrumbs" do presented_section = presented_manual_section presented_section.view_context.stubs(:request)