Index: lib/redmine/wiki_formatting/macros.rb =================================================================== --- lib/redmine/wiki_formatting/macros.rb (Revision 21053) +++ lib/redmine/wiki_formatting/macros.rb (Arbeitskopie) @@ -193,11 +193,13 @@ desc "Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:\n\n" + "{{child_pages}} -- can be used from a wiki page only\n" + "{{child_pages(depth=2)}} -- display 2 levels nesting only\n" + + "{{child_pages(reverse)}} -- reverse sorting order\n" + "{{child_pages(Foo)}} -- lists all children of page Foo\n" + "{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo" macro :child_pages do |obj, args| - args, options = extract_macro_options(args, :parent, :depth) + args, options = extract_macro_options(args, :parent, :depth, :reverse) options[:depth] = options[:depth].to_i if options[:depth].present? + options[:reverse] = true if options[:reverse].present? page = nil if args.size > 0 @@ -210,6 +212,10 @@ raise t(:error_page_not_found) if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project) pages = page.self_and_descendants(options[:depth]).group_by(&:parent_id) + + if options[:reverse] + pages.reverse() + render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id) end