diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-06-24 04:04:31 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-06-24 04:04:31 +0000 |
commit | a96cc93949fd8cf4bd91ce2fa49bb32b93a7de32 (patch) | |
tree | ecf30cad45401fe2c98ad2ff055b1fe591dfb57f /share/www/script | |
parent | fc01c0af15cfb080349856353d00c4d8216b4849 (diff) |
send browsers to /_utils/session.html when they need to log in
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@957407 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/futon.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/share/www/script/futon.js b/share/www/script/futon.js index 752717e9..2c29a5eb 100644 --- a/share/www/script/futon.js +++ b/share/www/script/futon.js @@ -10,6 +10,18 @@ // License for the specific language governing permissions and limitations under // the License. +// $$ inspired by @wycats: http://yehudakatz.com/2009/04/20/evented-programming-with-jquery/ +function $$(node) { + var data = $(node).data("$$"); + if (data) { + return data; + } else { + data = {}; + $(node).data("$$", data); + return data; + } +}; + (function($) { function Session() { @@ -126,6 +138,7 @@ $.couch.session({ success : function(r) { var userCtx = r.userCtx; + $$("#userCtx").userCtx = userCtx; if (userCtx.name) { $("#userCtx .name").text(userCtx.name).attr({href : "/_utils/document.html?"+encodeURIComponent(r.info.authentication_db)+"/org.couchdb.user%3A"+encodeURIComponent(userCtx.name)}); if (userCtx.roles.indexOf("_admin") != -1) { |