Use less2 classes in the user menu

pull/1/head
yflory 7 years ago
parent 41a082c46d
commit fc02f97d78

@ -579,19 +579,19 @@ define([
UIElements.createUserAdminMenu = function (Common, config) { UIElements.createUserAdminMenu = function (Common, config) {
var metadataMgr = Common.getMetadataMgr(); var metadataMgr = Common.getMetadataMgr();
var displayNameCls = config.displayNameCls || 'displayName'; var displayNameCls = config.displayNameCls || 'cp-toolbar-user-name';
var $displayedName = $('<span>', {'class': displayNameCls}); var $displayedName = $('<span>', {'class': displayNameCls});
var accountName = metadataMgr.getPrivateData().accountName; var accountName = metadataMgr.getPrivateData().accountName;
var origin = metadataMgr.getPrivateData().origin; var origin = metadataMgr.getPrivateData().origin;
var padType = metadataMgr.getMetadata().type; var padType = metadataMgr.getMetadata().type;
var $userName = $('<span>', {'class': 'userDisplayName'}); var $userName = $('<span>');
var options = []; var options = [];
if (config.displayNameCls) { if (config.displayNameCls) {
var $userAdminContent = $('<p>'); var $userAdminContent = $('<p>');
if (accountName) { if (accountName) {
var $userAccount = $('<span>', {'class': 'userAccount'}).append(Messages.user_accountName + ': '); var $userAccount = $('<span>').append(Messages.user_accountName + ': ');
$userAdminContent.append($userAccount).append(Util.fixHTML(accountName)); $userAdminContent.append($userAccount).append(Util.fixHTML(accountName));
$userAdminContent.append($('<br>')); $userAdminContent.append($('<br>'));
} }
@ -628,14 +628,14 @@ define([
if (accountName) { if (accountName) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'profile'}, attributes: {'class': 'cp-toolbar-menu-profile'},
content: Messages.profileButton content: Messages.profileButton
}); });
} }
if (padType !== 'settings') { if (padType !== 'settings') {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'settings'}, attributes: {'class': 'cp-toolbar-menu-settings'},
content: Messages.settingsButton content: Messages.settingsButton
}); });
} }
@ -643,18 +643,18 @@ define([
if (accountName) { if (accountName) {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'logout'}, attributes: {'class': 'cp-toolbar-menu-logout'},
content: Messages.logoutButton content: Messages.logoutButton
}); });
} else { } else {
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'login'}, attributes: {'class': 'cp-toolbar-menu-login'},
content: Messages.login_login content: Messages.login_login
}); });
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: {'class': 'register'}, attributes: {'class': 'cp-toolbar-menu-register'},
content: Messages.login_register content: Messages.login_register
}); });
} }
@ -722,31 +722,31 @@ define([
metadataMgr.onChange(updateButton); metadataMgr.onChange(updateButton);
updateButton(); updateButton();
$userAdmin.find('a.logout').click(function () { $userAdmin.find('a.cp-toolbar-menu-logout').click(function () {
Common.logout(function () { Common.logout(function () {
window.parent.location = origin+'/'; window.parent.location = origin+'/';
}); });
}); });
$userAdmin.find('a.settings').click(function () { $userAdmin.find('a.cp-toolbar-menu-settings').click(function () {
if (padType) { if (padType) {
window.open(origin+'/settings/'); window.open(origin+'/settings/');
} else { } else {
window.parent.location = origin+'/settings/'; window.parent.location = origin+'/settings/';
} }
}); });
$userAdmin.find('a.profile').click(function () { $userAdmin.find('a.cp-toolbar-menu-profile').click(function () {
if (padType) { if (padType) {
window.open(origin+'/profile/'); window.open(origin+'/profile/');
} else { } else {
window.parent.location = origin+'/profile/'; window.parent.location = origin+'/profile/';
} }
}); });
$userAdmin.find('a.login').click(function () { $userAdmin.find('a.cp-toolbar-menu-login').click(function () {
Common.setLoginRedirect(function () { Common.setLoginRedirect(function () {
window.parent.location = origin+'/login/'; window.parent.location = origin+'/login/';
}); });
}); });
$userAdmin.find('a.register').click(function () { $userAdmin.find('a.cp-toolbar-menu-register').click(function () {
Common.setLoginRedirect(function () { Common.setLoginRedirect(function () {
window.parent.location = origin+'/register/'; window.parent.location = origin+'/register/';
}); });

Loading…
Cancel
Save