diff options
-rw-r--r-- | index.html | 49 |
1 files changed, 45 insertions, 4 deletions
@@ -23,6 +23,7 @@ <script type="text/javascript"> var username = sessionStorage.getItem("username"); var token = sessionStorage.getItem("token"); + var app = sessionStorage.getItem("app"); alertbox = function() {} alertbox.warning = function (heading, message) { @@ -35,24 +36,50 @@ $('#alertbox').html('<div class="alert alert-info"><a class="close" data-dismiss="alert" href="#">×</a><h4 class="alert-heading">' + heading + '</h4>' + message + '</div>'); } + function selectApp(app) { + switch(app) { + case "musicpools": + $('#app-shows').hide(); + $('#nav-btn-shows').removeClass('active'); + $('#app-musicpools').show(); + $('#nav-btn-musicpools').addClass('active'); + break; + default: + $('#app-shows').show(); + $('#nav-btn-shows').addClass('active'); + $('#app-musicpools').hide(); + $('#nav-btn-musicpools').removeClass('active'); + app = 'shows'; + } + sessionStorage.setItem("app", app); + } + function authSuccess(data) { if (data.status == 'OK') { username = data.username; sessionStorage.setItem("username", username); + token = data.token; sessionStorage.setItem("token", token); + selectApp('shows'); + $('#username-field').html(username); $('#loginbox').slideUp(); $('#mainwindow').fadeIn(); } else { alertbox.error("Fehler beim Login", data.errorstring); + sessionStorage.removeItem("username"); delete username; $("#username").val('').focus(); + sessionStorage.removeItem("token"); delete token; $("#password").val(''); + + sessionStorage.removeItem("app"); + delete app; } } @@ -83,6 +110,8 @@ delete username; sessionStorage.removeItem("token"); delete token; + sessionStorage.removeItem("app"); + delete app; $(".alert").alert('close'); $("#username").val(''); @@ -124,8 +153,8 @@ <span class="brand">Radio Helsinki - Import</span> <div class="nav-collapse"> <ul class="nav"> - <li class="active"><a href="#">Sendungen</a></li> - <li><a href="#">Musikpools</a></li> + <li id="nav-btn-shows"><a href="#" onclick="selectApp('shows')">Sendungen</a></li> + <li id="nav-btn-musicpools"><a href="#" onclick="selectApp('musicpools')">Musikpools</a></li> </ul> <form id="logoutform" class="navbar-form pull-right"> <span class="navbar-text">angmeldet als <strong id="username-field">UNKNOWN</strong></span> @@ -138,10 +167,10 @@ </div> </div> - <div class="container-fluid"> + <div id="app-shows" class="container-fluid"> <div class="span12"> <div class="hero-unit"> - <h1>Hello, world!</h1> + <h1>Sendungen</h1> <p> This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting @@ -152,6 +181,17 @@ </div> </div> + <div id="app-musicpools" class="container-fluid"> + <div class="span12"> + <div class="hero-unit"> + <h1>Musikpools</h1> + <p> + coming soon! + </p> + </div> + </div> + </div> + </div> </div> @@ -159,6 +199,7 @@ <script type="text/javascript"> $("#loginform").submit(function(event) { login(); event.preventDefault(); }); $('#username-field').html(username); + selectApp('shows'); if(token && username) { $("#loginbox").hide(); } else { |