From 744ca0f344e28e5770f9c164fd9fac5579f23cc6 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Wed, 13 May 2015 18:08:15 +0200
Subject: Remove layout-loggedin, add extra links to nav when logged in
---
src/js/main.js | 27 ++++++++++++---------------
src/js/profile.js | 1 +
2 files changed, 13 insertions(+), 15 deletions(-)
(limited to 'src/js')
diff --git a/src/js/main.js b/src/js/main.js
index 1f869c4..5d17e02 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -9,22 +9,19 @@ $(document).ready(function(){
function setupLoginMenu() {
$('#nav .login-link').remove();
-
- if ($('#nav').find('[href="/profile"]').length == 0) {
- $('
').append(
+
+ var extra_links = {'Leagues': '/leagues', 'My Bots': '/profile/bots', 'Profile': '/profile', 'Logout': '/logout'};
+
+ for (var text in extra_links) {
+ var li = $('').append(
$('')
.attr('role', 'presentation')
- .attr('title', 'User profile')
- .attr('href', '/profile')
- .text('Profile'))
- .appendTo($('#nav'));
+ .attr('title', text)
+ .attr('href', extra_links[text])
+ .text(text));
+ if (extra_links[text] == selected_page) { // selected_page is added in layout-main.jade
+ li.addClass('active');
+ }
+ li.appendTo($('#nav'));
}
-
- $('').append(
- $('')
- .attr('role', 'presentation')
- .attr('title', 'Logout')
- .attr('href', '/logout')
- .text('Logout'))
- .appendTo($('#nav'));
}
\ No newline at end of file
diff --git a/src/js/profile.js b/src/js/profile.js
index 48600db..7b36432 100644
--- a/src/js/profile.js
+++ b/src/js/profile.js
@@ -4,6 +4,7 @@ $(document).ready(function(){
function setupGreeter() {
$('#greeter').append(' ' + $.cookie(Botleagues.cookie_login_email));
+
$('#banner').append(
$('')
.attr('id', 'banner-email')
--
cgit v1.2.3