0 of 1 found this page helpful

DekiCon Sample 5: Notebook

    Table of contents
    No headers

    This is a simple notebook application.  Below it shows the notes attached with a button to create new notebook notes that contain automatically pre-filled content.

    <p>{{ wiki.create{label: "Add a note", template: "NotebookPage", title: date.format(date.now, "yyyy MMMM, d") .. ' (' .. user.name .. ')' } }}</p>
    <ul>
        <li foreach="var p in page.subpages">{{web.link(p.uri, p.title)}} <span style="color: rgb(128, 128, 128); font-size: small;">({{#p.comments}} comments)</span><br />
        {{ var h = wiki.page(p.path); h["//*[@class='summary']"] }}</li>
    </ul>
    

            

    Was this page helpful?
    Tag page
    Viewing 5 of 5 comments: view all
    I would like to hide the notse from the left menu.
    I don't want to turn a note private, I just want the users to access the notes in a "News page" but as should be hundreds, maybe thousands, of notes, I wouldn't like to show them in the left menu.

    How can I do that?

    Thanks! edited 07:21, 5 Feb 2009
    Posted 07:19, 5 Feb 2009
    This would be better if it sorted the notes from most recent to oldest. I will need to look into that.
    Posted 05:59, 20 Mar 2009
    I used the blog template & got this code to sort newest topics on top:


    <p>{{ wiki.create{label: "Add a note", template: "NotebookPage", title: date.format(date.now, "yyyy MMMM, d") .. ' (' .. user.name .. ')'} }}</p>
    <div init="var ix = wiki.GetSearch{ query: 'path:' .. string.Replace( page.Path, ':', '\\:' ) .. '/*', sortby: '-date', type: 'wiki', max: $max_items ??, constraint: $constraint ?? '' }">
    <ul>
    <li foreach="var p in ix" style="margin-bottom: 0.8em;">{{web.link(p.uri, p.title)}} <span style="color: rgb(128, 128, 128); font-size: small;">({{#p.comments}} comments)</span><br />
    {{ var h = wiki.page(p.path); h["//*[@class='summary']"] }}</li>
    </ul>
    </div>


    When used as a template, you can pass in the arguments max_items and constraint to restrict the display. I also discovered that you can send these note topics to pages with the talk: prefix, but for my purposes I'd rather have them in the left nav.
    Posted 08:38, 20 Apr 2009
    I have figured out the sorting. But I would be interested in what anyone comes up with for hiding the notes under a Talk page. In my testing it does not seem as if you can make subpages to a Talk Page.
    Posted 10:53, 21 Apr 2009
    For those of us who haven't figured it out. Replace the foreach loop with:
    <li foreach="var p in list.sort(map.values(page.subpages), _, _, '-date.compare($left.revisions[0].date, $right.revisions[0].date)')">

    @rberinger: I can't seem to recreate this issue with talk pages you are having, can you clarify? edited 15:16, 12 Jun 2009
    Posted 11:33, 10 Jun 2009
    Viewing 5 of 5 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by