Add scripts to create myops-getqueryview:
[myops.git] / web / query / vendor / couchapp / evently / account / _init.js
diff --git a/web/query/vendor/couchapp/evently/account/_init.js b/web/query/vendor/couchapp/evently/account/_init.js
new file mode 100644 (file)
index 0000000..4ead648
--- /dev/null
@@ -0,0 +1,16 @@
+function() {
+  var elem = $(this);
+  $$(this).userCtx = null;
+  $.couch.session({
+    success : function(r) {
+      var userCtx = r.userCtx;
+      if (userCtx.name) {
+        elem.trigger("loggedIn", [r]);
+      } else if (userCtx.roles.indexOf("_admin") != -1) {
+        elem.trigger("adminParty");
+      } else {
+        elem.trigger("loggedOut");
+      };
+    }
+  });
+}
\ No newline at end of file