Add scripts to create myops-getqueryview:
[myops.git] / web / query / evently / account / loggedIn / data.js
diff --git a/web/query/evently/account/loggedIn/data.js b/web/query/evently/account/loggedIn/data.js
new file mode 100644 (file)
index 0000000..3392de0
--- /dev/null
@@ -0,0 +1,19 @@
+function(e, r) {
+  var app = $$(this).app;
+  var path = app.require("vendor/couchapp/lib/path").init(app.req);
+  var data = {
+    name : r.userCtx.name,
+    uri_name : encodeURIComponent(r.userCtx.name),
+    auth_db : encodeURIComponent(r.info.authentication_db) 
+  };
+  if (r.userCtx.roles.indexOf("_admin") != -1 || r.userCtx.roles.indexOf("author") != -1) {
+    if (app.req.path.indexOf("post-page") == -1) {
+      data.postPath = path.show("edit")+"/";
+      data.postMessage = "New post.";
+    } else {
+      data.postPath = path.show("edit", app.req.query.startkey[0]);
+      data.postMessage = "Edit this post.";
+    }    
+  }
+  return data;
+}
\ No newline at end of file