Add scripts to create myops-getqueryview:
[myops.git] / web / query / vendor / couchapp / evently / profile / loggedIn.js
1 function(e, r) {
2   var userCtx = r.userCtx;
3   var widget = $(this);
4   // load the profile from the user doc
5   var db = $.couch.db(r.info.authentication_db);
6   var userDocId = "org.couchdb.user:"+userCtx.name;
7   db.openDoc(userDocId, {
8     success : function(userDoc) {
9       var profile = userDoc["couch.app.profile"];
10       if (profile) {
11         // we copy the name to the profile so it can be used later
12         // without publishing the entire userdoc (roles, pass, etc)
13         profile.name = userDoc.name;
14         $$(widget).profile = profile;
15         widget.trigger("profileReady", [profile]);
16       } else {
17         widget.trigger("noProfile", [userCtx]);
18       }
19     }
20   });
21 }