Sign in / Sign out links

This commit is contained in:
Mattias Erming 2014-06-15 23:45:16 +02:00
parent 0757450859
commit d805e1edb9
2 changed files with 12 additions and 4 deletions

View File

@ -19,7 +19,10 @@
<aside id="sidebar">
<section>
<h1>Shout</h1>
<a href="#sign-in">Sign in</a>
<% if (password) { %>
<a id="login" href="#sign-in">Sign in</a>
<a id="logout" href="" style="display: none;">Sign out</a>
<% } %>
</section>
<div id="networks">
</div>
@ -32,7 +35,7 @@
<h2>You need to sign in to continue.</h2>
<form id="sign-in-form" method="post">
<h3>Password:</h3>
<input type="password" id="sign-in-input">
<input id="sign-in-input" type="password" autofocus>
<button type="submit" class="btn">
Sign in
</button>

View File

@ -65,8 +65,8 @@ $(function() {
function event(e, data) {
switch (e) {
case "auth":
chat.add($("#networks")).empty();
$("#sign-in").addClass("active").find("#sign-in-input").focus();
$("#networks").add(chat).empty();
$("#login").trigger("click");
break;
case "debug":
@ -120,6 +120,11 @@ $(function() {
.find(".chat")
.sticky();
$("#login").hide();
$("#logout").show().on("click", function(e) {
e.stopPropagation();
});
var networks = $("#networks")
.html(render("networks", {networks: data.networks}))
.find("a")