Extend child pages macro to display child pages based on page parameter
A feature I would like to see is a macro that would create a list of child pages based on an input of a page for table of contents/index purposes.
ParentA has 3 Child pages, ChildA,ChildB,ChildC.
Proposed: child_pages(ParentA) displays the child pages of the page ParentA in a list. (retain default behavior with no param)
This way someone can easily add a list of pages concerning a topic.
- Web Server
- Mail Server
- Upstairs Printer
- Downstairs Printer
#2 Updated by Jean-Philippe Lang almost 9 years ago
- Status changed from New to Closed
- Resolution set to Fixed
Feature added in r2053. Implementation is slightly different than your patch.
By default, the link to the parent is not displayed (so that it works just like when calling the macro without parameter). But an option is added to do so.
child_pages(Foo) # => diplays child pages only child_pages(Foo, parent=1) # => diplays a link to Foo and its child pages
WikiHelper#render_page_hierarchy method is moved to
ApplicationHelper so that this macro can be called from anywhere (not only from wiki pages) by giving the page title. Some tests are also added.