Add scripts to create myops-getqueryview:
[myops.git] / web / query / shows / edit.js
1 function(doc, req) {  
2   var ddoc = this;
3   var Mustache = require("lib/mustache");
4   var path = require("vendor/couchapp/lib/path").init(req);
5
6   var indexPath = path.list('index','recent-posts',{descending:true, limit:10});
7   var feedPath = path.list('index','recent-posts',{descending:true, limit:10, format:"atom"});
8   var commentsFeed = path.list('comments','comments',{descending:true, limit:10, format:"atom"});
9
10   var data = {
11     header : {
12       index : indexPath,
13       blogName : ddoc.blog.title,
14       feedPath : feedPath,
15       commentsFeed : commentsFeed
16     },
17     scripts : {},
18     pageTitle : doc ? "Edit: "+doc.title : "Create a new post",
19     assets : path.asset()
20   };
21   
22   if (doc) {
23     data.doc = JSON.stringify(doc);
24     data.title = doc.title;
25     data.body = doc.body;
26     data.tags = doc.tags.join(", ");
27   } else {
28     data.doc = JSON.stringify({
29       type : "post",
30       format : "markdown"
31     });
32   }
33
34   return Mustache.to_html(ddoc.templates.edit, data, ddoc.templates.partials);
35 }