diff options
author | Camil Staps | 2015-05-13 17:42:31 +0200 |
---|---|---|
committer | Camil Staps | 2015-05-13 17:42:31 +0200 |
commit | 9f3483fccf26e43eed5ccb9945c17cbb7c82a56d (patch) | |
tree | 92ccdc39825f9a88b0b16414182b579df6722aaf /src/js/main.js | |
parent | Different styles structure (relies on gulpfile concatenation); new styles added (diff) |
Fixed BotleaguesFrontend -> Botleagues changes (JS); added profile page with different jade base layout
Diffstat (limited to 'src/js/main.js')
-rw-r--r-- | src/js/main.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/js/main.js b/src/js/main.js index 4444273..1f869c4 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,21 +1,25 @@ $(document).ready(function(){ // Show profile link instead of login if user is logged in - var email = $.cookie(BotleaguesFrontend.cookie_login_email); - if (typeof email != 'undefined' && $.cookie(BotleaguesFrontend.cookie_login_valid_till) > (new Date()).getTime()) { - setupLoginMenu(email); + var email = $.cookie(Botleagues.cookie_login_email); + if (typeof email != 'undefined' && $.cookie(Botleagues.cookie_login_valid_till) > (new Date()).getTime()) { + setupLoginMenu(); } }); -function setupLoginMenu(email) { +function setupLoginMenu() { $('#nav .login-link').remove(); - $('<li>').append( - $('<a>') - .attr('role', 'presentation') - .attr('title', 'User profile') - .attr('href', '/profile') - .text(email)) - .appendTo($('#nav')); + + if ($('#nav').find('[href="/profile"]').length == 0) { + $('<li>').append( + $('<a>') + .attr('role', 'presentation') + .attr('title', 'User profile') + .attr('href', '/profile') + .text('Profile')) + .appendTo($('#nav')); + } + $('<li>').append( $('<a>') .attr('role', 'presentation') |