aboutsummaryrefslogtreecommitdiff
path: root/src/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/main.js')
-rw-r--r--src/js/main.js29
1 files changed, 20 insertions, 9 deletions
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();
- $('<li>').append(
- $('<a>')
- .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();
+ $('<li>').append(
+ $('<a>')
+ .attr('role', 'presentation')
+ .attr('title', 'User profile')
+ .attr('href', '/profile')
+ .text(email))
+ .appendTo($('#nav'));
+ $('<li>').append(
+ $('<a>')
+ .attr('role', 'presentation')
+ .attr('title', 'Logout')
+ .attr('href', '/logout')
+ .text('Logout'))
+ .appendTo($('#nav'));
+} \ No newline at end of file