diff options
author | Camil Staps | 2015-05-13 18:08:15 +0200 |
---|---|---|
committer | Camil Staps | 2015-05-13 18:08:15 +0200 |
commit | 744ca0f344e28e5770f9c164fd9fac5579f23cc6 (patch) | |
tree | dbdb0aff6b3f5a8a9ed0056424f2a4eb8f23755d /src/js/main.js | |
parent | Faster gulpfile (diff) |
Remove layout-loggedin, add extra links to nav when logged in
Diffstat (limited to 'src/js/main.js')
-rw-r--r-- | src/js/main.js | 27 |
1 files changed, 12 insertions, 15 deletions
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) { - $('<li>').append( + + var extra_links = {'Leagues': '/leagues', 'My Bots': '/profile/bots', 'Profile': '/profile', 'Logout': '/logout'}; + + for (var text in extra_links) { + var li = $('<li>').append( $('<a>') .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')); } - - $('<li>').append( - $('<a>') - .attr('role', 'presentation') - .attr('title', 'Logout') - .attr('href', '/logout') - .text('Logout')) - .appendTo($('#nav')); }
\ No newline at end of file |