The MyStatus template is a small DekiScript application that uses page comments to store user status messages. It's entirely self-contained in the code below and only requires the Deki AJAX API extension to work.
Note: Deki AJAX API and JEM are experimental features. This sample requires MindTouch 2009 (Deki 9.02 "Lyons").
The status application can be embedded on any page by invoking the wiki template.
{{ MyStatus() }}
// includes
dekiapi();
// status input form
<form id="chatter" name="chatter">
<div>
<textarea rows="3" cols="50" id="update" name="update" />
</div>
<input type="hidden" value=(page.api) name="pageAPI" /><br />
<input type="button" value="Publish It" ctor="
when($this.click) {
Deki.Api.PostText(Deki.Env.PageApi + '/comments?title=MyStatus', #update.val(), function() {
#update.val('');
@update();
});
}" disabled=(user.anonymous ? 'disabled' : _)
/>
</form>
// status updates
<h2>"Chatter Output"</h2>
<div ctor="when(@update) Deki.Api.Reload(this);" id="results">
<hr />
foreach(var comment in list.reverse(page.comments) where __count < 10) {
var user = comment.author;
<div>
<a href=(user.uri)><img src=(user.gravatar & { s: 30 }) alt="" />user.name</a><br />
comment.text;<br />
"posted: " .. comment.date;<br />
<hr />
</div>
}
</div>
// initialization script
<script type="text/javascript">"
var pageURL = document.chatter.pageAPI.value + '/comments';
Deki.$(function() {
Deki.$('.gallery, .pageInfo, .file, #comments').css('display','none');
});
"</script>
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by
(It's really, really hard not to like deki.)