Skip to content

Commit

Permalink
Simplify HRMC rendering with new schema data
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Jul 18, 2022
1 parent f31a27c commit 773cab7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/presenters/content_item/manual_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions app/presenters/hmrc_manual_section_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ def base_path
details["manual"]["base_path"]
end

def title
details["manual"]["title"]
end

def breadcrumbs
crumbs = manual_breadcrumbs.dup

Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions test/presenters/hmrc_manual_section_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 773cab7

Please sign in to comment.