Initial dev repository
[kcls-web.git] / opac / extras / mobile / mobile / js / login_bar.js
diff --git a/opac/extras/mobile/mobile/js/login_bar.js b/opac/extras/mobile/mobile/js/login_bar.js
new file mode 100644 (file)
index 0000000..6551018
--- /dev/null
@@ -0,0 +1,2 @@
+module("login_bar",imports("template","plugin"),function(c){var b,d;b=c.template('<a class="link login">Log in</a>\n<span>to see account details</span>');d=c.template('<a class="link logout">Log out</a>\n<span>Currently logged in as</span>\n<span class="username"><%= username %></span>');return $.fn.login_bar=function(){return this.plugin("login_bar").html(b({})).delegate(".login","click",function(){thunk(imports("login_window"),function(){return $("#login_window").login_window().refresh()});return false}).delegate(".logout",
+"click",function(){thunk(imports("eg.eg_api"),function(a){return a.openils("auth.session.delete")});return false}).subscribe("login_event",function(a){a=d({username:a});$(this).html(a);return false}).subscribe("logout_event",function(){$(this).html(b({}));return false})}});