Skip to content

Commit 5fd0de8

Browse files
committed
Remove unneeded override
We can now use the `include_child_resources` option
1 parent a6ae469 commit 5fd0de8

3 files changed

Lines changed: 2 additions & 16 deletions

File tree

lib/table_of_contents_helpers.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@
22
# Extra helpers for customising the rendering of the table of contents in the sidebar
33
# so it accomodates a separate table of contents for the `v4` section of the site
44
module TableOfContentsHelpers
5-
##
6-
# Override `render_page_tree` so it can be bypassed when rendering the children
7-
# of a specific given page (stored in `@parent_page`) (see `without_child_pages_for` bellow).
8-
# This enables not rendering the child pages of the `index`, as they'll be rendered
9-
# individually as well.
10-
# This is due to the lack of abstraction for the test checking whether to render a resource
11-
# as a single item or an item the tree of its children
12-
# See: https://github.com/alphagov/tech-docs-gem/blob/207bcb8593197f3aad8983018ca0a91db7783410/lib/govuk_tech_docs/table_of_contents/helpers.rb#L74
13-
def render_page_tree(resources, *args)
14-
return "" if resources == @parent_page&.children
15-
16-
super(resources, *args)
17-
end
18-
195
##
206
# Temporarily excludes the children of the given page
217
# from being rendered by `render_page_tree` while it runs

source/layouts/v4.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ wrap_layout :core do
1717

1818
with_page_in_navigation(v4_index) do
1919
without_child_pages_for(v4_index) do
20-
render_page_tree(resources, current_page, config, html)
20+
render_page_tree(resources, current_page, config, html, include_child_resources: false)
2121
end
2222
end
2323
end

source/layouts/v5.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ wrap_layout :core do
1717

1818
with_page_in_navigation(v5_index) do
1919
without_child_pages_for(v5_index) do
20-
render_page_tree(resources, current_page, config, html)
20+
render_page_tree(resources, current_page, config, html, include_child_resources: false)
2121
end
2222
end
2323
end

0 commit comments

Comments
 (0)