From 9f3483fccf26e43eed5ccb9945c17cbb7c82a56d Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 13 May 2015 17:42:31 +0200 Subject: Fixed BotleaguesFrontend -> Botleagues changes (JS); added profile page with different jade base layout --- src/js/main.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/js/main.js') 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(); - $('
  • ').append( - $('') - .attr('role', 'presentation') - .attr('title', 'User profile') - .attr('href', '/profile') - .text(email)) - .appendTo($('#nav')); + + if ($('#nav').find('[href="/profile"]').length == 0) { + $('
  • ').append( + $('') + .attr('role', 'presentation') + .attr('title', 'User profile') + .attr('href', '/profile') + .text('Profile')) + .appendTo($('#nav')); + } + $('
  • ').append( $('') .attr('role', 'presentation') -- cgit v1.2.3