Table of contents
No headers
/***

    USAGE:
   
    FeaturedPages
        shows a table of pages by popularity, rating, creation, and updates.
       
    PARAMETERS:

    (optional) description : str
        description of featured pages; default: nothing
   
    (optional) pages : list
        list of page objects to use; default: subpages of invoking page
      
    (optional) id : str
        dom id used for table; default: none
      
    (optional) missing : xml
        placeholder text when no pages were found
     
    (optional) limit : num
        max number of articles to show in each section; default: 15
***/

var description = $0 ?? $description;
var pages = $1 ?? $pages ?? map.values(page.subpages);
var id = $2 ?? $id;
var missing = $3 ?? $missing;
var limit = $4 ?? $limit ?? 15;

// text definitions
var viewed_title = wiki.localize('MindTouch.IDF.kb.featured.viewed.title');
var viewed_label = wiki.localize('MindTouch.IDF.kb.featured.viewed.label');
var rated_title = wiki.localize('MindTouch.IDF.kb.featured.rated.title');
var rated_label = wiki.localize('MindTouch.IDF.kb.featured.rated.label');
var created_title = wiki.localize('MindTouch.IDF.kb.featured.created.title');
var created_label = wiki.localize('MindTouch.IDF.kb.featured.created.label');
var updated_title = wiki.localize('MindTouch.IDF.kb.featured.updated.title');
var updated_label = wiki.localize('MindTouch.IDF.kb.featured.updated.label');

<table border="0" id=(id) width="100%">
    <tbody>
        if(#string.trim(description ?? '')) {
            <tr>
                <td align="left" colspan="2" valign="top">
                    <p> description </p>
                </td>
            </tr>
        }
        if(#pages) {
            <tr>
                <td align="left" valign="top" width="50%">
                    <div class="left">
                        <h3> viewed_title; " "; <span class="count"> viewed_label </span></h3>
                        template("MindTouch/Controls/ListPages", {
                            pages: pages,
                            sort: 'viewcount',
                            reverse: true,
                            style: 'bullets',
                            limit: limit
                        });
                    </div>
                </td>
                <td align="left" valign="top" width="50%">
                    <div class="left">
                        <h3> rated_title; " "; <span class="count"> rated_label </span></h3>
                        template("MindTouch/Controls/ListPages", {
                            pages: pages,
                            sort: 'rated',
                            reverse: true,
                            style: 'bullets',
                            limit: limit
                        });
                    </div>
                </td>
            </tr>
            <tr>
                <td align="left" valign="top">
                    <div class="left">
                        <h3> updated_title; " "; <span class="count"> updated_label </span></h3>
                        template("MindTouch/Controls/ListPages", {
                            pages: pages,
                            sort: 'updated',
                            reverse: true,
                            style: 'bullets',
                            limit: limit
                        });
                    </div>
                </td>
                <td align="left" valign="top">
                    <div class="left">
                        <h3> created_title; " "; <span class="count"> created_label </span></h3>
                        template("MindTouch/Controls/ListPages", {
                            pages: pages,
                            sort: 'created',
                            reverse: true,
                            style: 'bullets',
                            limit: limit
                        });
                    </div>
                </td>
            </tr>
        } else {
            <tr>
                <td>
                    missing;
                </td>
            </tr>
        }
    </tbody>
</table>
Page statistics
30 view(s), 1 edit(s) and 4754 character(s)

Tags

This page has no custom tags set.

Comments

You must to post a comment.

Attach file

Attachments