[Sputnik-list] "Messages" section

Yuri Takhteyev yuri at sims.berkeley.edu
Sat Mar 8 07:55:30 GMT+2 2008


>  Okay, shall we have an API for this specifically, or shall we just
>  make the elements of the table arrays:
>
>  table.insert(node.messages, {"error", "some error message here"})

I went ahead and wrote and committed a change to add the messages,
using your patch as inspiration.

You can now add a message by calling something like

node:post_error("Whoops!")
node:post_warning("Hmm")
node:post_success("Yay!")
node:post_notice("Not sure what the notices are for, but blueprintcss
has them, and so will we.")

In all cases, the messages get inserted as a <p>'s before the content
(without a surrounding div), with p's class set to "error", "warning",
"success" or "notice".  Of course, you can change this when you
customize your wiki.

I also decided to get rid of the message subtemplate and put
do_messages straight into MAIN.  It's simpler this way.

The patch is at
http://gitorious.org/projects/sputnik/repos/mainline/commit/13bb686585200101d0bfd7a44179cf752dada53f

I really like the way they all diffs for the commit on the same page, BTW.

Speaking of gitorious: you can download tarballs - see the link at the
very bottom of http://gitorious.org/projects/sputnik/repos/mainline/tree/master

And as I mentioned to Jim yesterday, there is an RSS feed for commits:
http://gitorious.org/projects/sputnik/repos/mainline/browse.atom

>  Is Blueprint being used in the default installation right now?  I
>  didn't see any signs of it, so I wasn't sure how you would like this
>  styled.  I'll continue to work on this in a branch.

No, Pierre is working on it.  But I figured we might as well be
compatible with it.

>  No, don't want them stored.. not sure what API is appropriate for this
>  sort of thing.

Saving and loading is controlled by the "fields" field (in the node
itself or in its prototypes).  Once a node is loaded, you can add more
fields or methods to it.  Those additional fields won't be saved:
those are basically clients' annotations on the node that versium
doesn't recognize.  But they can be useful for passing information
around within Sputnik.  You can attach them anywhere, but I attach
most of those sort of things in Sputnik:prime_node(), which is called
from Sputnik:get_node().  This way if you ask sputnik for a node, it
will already come with post_*() methods.  You can avoid this by
calling sputnik:get_node("My_Node", "basic").

>  Also, it seems you used spaces (not tabs) set at three spaces width.
>  Is this correct (need to alter my vim settings so I don't clobber the
>  indentation you have.

Yes, I always indent with three spaces in Sputnik.  Please no tabs.

- yuri

-- 
http://sputnik.freewisdom.org/



More information about the Sputnik-list mailing list