diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json index 0bf297ce54..eef538f4bd 100644 --- a/public/language/en_GB/user.json +++ b/public/language/en_GB/user.json @@ -9,6 +9,7 @@ "age": "Age", "joined": "Joined", "lastonline": "Last Online", + "profile": "Profile", "profile_views": "Profile views", "reputation": "Reputation", "posts": "Posts", diff --git a/public/src/forum/account.js b/public/src/forum/account.js index 51f43d5ffb..f02cb17f29 100644 --- a/public/src/forum/account.js +++ b/public/src/forum/account.js @@ -88,11 +88,7 @@ define(['forum/accountheader'], function(header) { return; } - translator.get('global:' + data.status, function(translated) { - onlineStatus.find('span span').text(translated); - onlineStatus.find('i').attr('class', 'fa fa-circle status ' + data.status); - }); - + onlineStatus.attr('class', 'account-online-status fa fa-circle status ' + data.status); }; return Account; diff --git a/public/src/forum/accountedit.js b/public/src/forum/accountedit.js index bffa7660c0..b33d8f2d4a 100644 --- a/public/src/forum/accountedit.js +++ b/public/src/forum/accountedit.js @@ -42,7 +42,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) { $('.account-username-box a').each(function(index) { $(this).attr('href', $(this).attr('href').replace(oldslug, data.userslug)); }); - $('.account-username a:first-child').html(userData.username); + $('.account-username-box').attr('data-userslug', data.userslug); $('#user-profile-link').attr('href', config.relative_path + '/user/' + data.userslug); diff --git a/public/src/forum/accountheader.js b/public/src/forum/accountheader.js index 1f5c552783..291d25e050 100644 --- a/public/src/forum/accountheader.js +++ b/public/src/forum/accountheader.js @@ -2,45 +2,60 @@ define(function() { var AccountHeader = {}; AccountHeader.init = function() { - var yourid = templates.get('yourid'), - theirid = templates.get('theirid'); + AccountHeader.createMenu(); + hideLinks(); + + selectActivePill(); + } + + AccountHeader.createMenu = function() { + var userslug = $('.account-username-box').attr('data-userslug'); + + var html ='
'; + + + translator.translate(html, function(translatedHtml) { + $('.account-username-box').append(translatedHtml); + selectActivePill(); + hideLinks(); + }); + } + + function hideLinks() { + var yourid = templates.get('yourid'), + theirid = templates.get('theirid'); + var editLink = $('#editLink'); var settingsLink = $('#settingsLink'); var favouritesLink = $('#favouritesLink'); - if (yourid === "0" || yourid !== theirid) { + if (parseInt(yourid, 10) === 0 || parseInt(yourid, 10) !== parseInt(theirid, 10)) { editLink.hide(); settingsLink.hide(); favouritesLink.hide(); } + } - jQuery('.account-sub-links span a').removeClass('bold').each(function() { - var href = this.getAttribute('href'); + function selectActivePill() { + $('.account-sub-links li').removeClass('active').each(function() { + var href = $(this).find('a').attr('href'); if (window.location.href.indexOf(href) !== -1) { - jQuery(this).addClass('bold'); + $(this).addClass('active'); return false; } }); } - AccountHeader.createMenu = function() { - var userslug = $('.account-username-box').attr('data-userslug'); - - var html = '{posts.content}
+ +