From f88789856be8a484bb1800a1b1695c2ac4b8a3b1 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 13 May 2015 12:32:27 +0200 Subject: Logout --- src/js/main.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/js/main.js') diff --git a/src/js/main.js b/src/js/main.js index d3ab688..4444273 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -3,13 +3,24 @@ $(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()) { - $('#nav .login-link').remove(); - $('
  • ').append( - $('') - .attr('role', 'presentation') - .attr('title', 'User profile') - .attr('href', '/profile') - .text(email)) - .appendTo($('#nav')); + setupLoginMenu(email); } -}); \ No newline at end of file +}); + +function setupLoginMenu(email) { + $('#nav .login-link').remove(); + $('
  • ').append( + $('') + .attr('role', 'presentation') + .attr('title', 'User profile') + .attr('href', '/profile') + .text(email)) + .appendTo($('#nav')); + $('
  • ').append( + $('') + .attr('role', 'presentation') + .attr('title', 'Logout') + .attr('href', '/logout') + .text('Logout')) + .appendTo($('#nav')); +} \ No newline at end of file -- cgit v1.2.3