Feature #1975

Extend child pages macro to display child pages based on page parameter

Added by Kien Tran about 9 years ago. Updated over 3 years ago.

Status:ClosedStart date:2008-09-30
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Wiki
Target version:0.8
Resolution:Fixed

Description

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.

Example:
ParentA has 3 Child pages, ChildA,ChildB,ChildC.

Current: child_pages displays the child pages of the current page in a list.
Proposed: child_pages(ParentA) displays the child pages of the page ParentA in a list. (retain default behavior with no param)
  • ParentA
    • ChildA
    • ChildB
    • ChildC
Real World Example:
This way someone can easily add a list of pages concerning a topic.
  • Servers
    • Web Server
    • Mail Server
  • Printers
    • Upstairs Printer
    • Downstairs Printer

Associated revisions

Revision 2053
Added by Jean-Philippe Lang about 9 years ago

Extends child_pages macro to display child pages based on page parameter (#1975).
It can also be called from anywhere now (not only from wiki pages).

History

#1 Updated by Jan TopiƄski about 9 years ago

I added a patch #2174 witch (hopefully :)) solves this request.

#2 Updated by Jean-Philippe Lang about 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.

Examples:

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.

#3 Updated by Gian Luca over 3 years ago

Update {{macro_list}} to document this new feature otherwise is hard to discover

#4 Updated by Gian Luca over 3 years ago

Update {{macro_list}} to document this new feature otherwise it is hard to discover

Also available in: Atom PDF