![]() |
Search:
|
Page last modified 01:04, 2 Oct 2011 by tehmina.khan
Template:MindTouch > IDF > Controls > ListTopicSubpages
ListTopicSubpagesTable of contentsNo headers/*** USAGE: ListTopicSubpages(topic_page, pages, categories) Generates a list of subpages for a given topic page PARAMETERS: topic_page : page Root topic page for which to display sublist pages : list List of all topic pages the guide covers. Expected to be tagged with tutorial, reference, troubleshooting or topic. (optional) categories : list of maps Array of items such as [{category: 'tutorial'}, {category:'reference'}] containing the fields to search for and display. ***/ var topic_page = $topic_page ?? $0; var pages = $pages ?? $1; var categories = $categories ?? $2 ?? [ {category: 'topic'}, {category: 'tutorial'}, {category: 'reference'}, {category: 'troubleshooting'} ]; var subpages = [p foreach var p in pages where p.parent.id == topic_page.id]; var pages_in_category = {}; var has_subpages = false; foreach (var c in categories) { let pages_in_category = pages_in_category .. { (c.category): [p foreach var p in subpages where p[c.category]] }; if (#pages_in_category[c.category]) { let has_subpages = true; } } if (!has_subpages) { return; } <div class="noindex"> <div class="mt-idf-subtopic-container"> foreach (var c in categories) { if (#pages_in_category[c.category]) { <ul id=('mt-idf-topic-' .. topic_page.id .. '-' .. c.category .. '-details') class=('mt-idf-topic-' .. topic_page.id .. '-details')> foreach (var p in pages_in_category[c.category]) { <li> web.link(p.uri, p.title); <span class="mt-idf-category">'(' .. wiki.localize('MindTouch.IDF.guide.category.' .. c.category) .. ')'</span> </li> } </ul> } } </div> </div> |
|
Powered by MindTouch Core |