-
Notifications
You must be signed in to change notification settings - Fork 3
/
todo.js
30 lines (24 loc) · 797 Bytes
/
todo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function(head, req) {
// !json templates.head
// !json templates.item
// !json templates.tail
var state = req.query.state || 'unread';
var title = "items in " + state + " state";
provides("html", function() {
var row;
var data = {
title: title,
mainid: "items"
};
var Mustache = require("vendor/couchapp/lib/mustache");
var path = require("vendor/couchapp/lib/path").init(req);
send(Mustache.to_html(templates.head, data));
send("<h1>" + title + "</h1>");
send('<ul id="items">\n');
while( (row = getRow()) ) {
send(Mustache.to_html(templates.item, row.doc));
}
send("</ul>\n");
send(Mustache.to_html(templates.tail, data));
});
}