');
+ if (account) {
+ var $userAccount = $('', {'class': 'userAccount'}).append(Messages.user_accountName + ': ' + accountName);
+ $userAdminContent.append($userAccount);
+ $userAdminContent.append($(' ');
- if (account) {
- var $userAccount = $('', {'class': 'userAccount'}).append(Messages.user_accountName + ': ' + accountName);
- $userAdminContent.append($userAccount);
- $userAdminContent.append($('
'));
+ }
+ var $userName = $('', {'class': 'userDisplayName'});
+ if (config.displayName) {
+ // Hide "Display name:" in read only mode
+ $userName.append(Messages.user_displayName + ': ');
+ $userName.append($displayedName.clone());
+ }
+ //$userName.append($displayedName.clone()); TODO remove ?
+ $userAdminContent.append($userName);
+ var options = [];
+ if (config.displayNameCls) {
+ options.push({
+ tag: 'p',
+ attributes: {'class': 'accountData'},
+ content: $userAdminContent.html()
+ });
+ }
+ // Add the change display name button if not in read only mode
+ if (config.changeNameButtonCls && config.displayChangeName) { //readOnly !== 1) { TODO
+ options.push({
+ tag: 'a',
+ attributes: {'class': config.changeNameButtonCls},
+ content: Messages.user_rename
+ });
+ }
+ var parsed = parsePadUrl(window.location.href);
+ if (parsed && (!parsed.type || parsed.type && parsed.type !== 'drive')) {
+ options.push({
+ tag: 'a',
+ attributes: {
+ 'target': '_blank',
+ 'href': '/drive/'
+ },
+ content: Messages.login_accessDrive
+ });
+ }
+ // Add login or logout button depending on the current status
+ if (account) {
+ if (parsed && parsed.type && parsed.type !== 'settings') {
+ options.push({
+ tag: 'a',
+ attributes: {'class': 'settings'},
+ content: Messages.settingsButton
+ });
+ }
+ options.push({
+ tag: 'a',
+ attributes: {'class': 'logout'},
+ content: Messages.logoutButton
+ });
+ } else {
+ options.push({
+ tag: 'a',
+ attributes: {'class': 'login'},
+ content: Messages.login_login
+ });
+ options.push({
+ tag: 'a',
+ attributes: {'class': 'register'},
+ content: Messages.login_register
+ });
+ }
+ var $icon = $('', {'class': 'fa fa-user'});
+ var $userbig = $('', {'class': 'big'}).append($displayedName.clone());
+ var $userButton = $('
'));
- }
- var $userName = $('', {'class': 'userDisplayName'});
- if (readOnly !== 1) {
- // Hide "Display name:" in read only mode
- $userName.append(Messages.user_displayName + ': ');
- }
- $userName.append($displayedName.clone());
- $userAdminContent.append($userName);
- var options = [{
- tag: 'p',
- attributes: {'class': 'accountData'},
- content: $userAdminContent.html()
- }];
- // Add the change display name button if not in read only mode
+
+ var userMenuCfg = {
+ displayNameCls: USERNAME_CLS,
+ changeNameButtonCls: USERBUTTON_CLS,
+ };
if (readOnly !== 1) {
- options.push({
- tag: 'a',
- attributes: {'class': USERBUTTON_CLS},
- content: Messages.user_rename
- });
- }
- var parsed = Cryptpad.parsePadUrl(window.location.href);
- if (parsed && parsed.type && parsed.type !== 'drive') {
- options.push({
- tag: 'a',
- attributes: {
- 'target': '_blank',
- 'href': '/drive/'
- },
- content: Messages.login_accessDrive
- });
- }
- // Add login or logout button depending on the current status
- if (account) {
- options.push({
- tag: 'a',
- attributes: {'class': 'logout'},
- content: Messages.logoutButton
- });
- } else {
- options.push({
- tag: 'a',
- attributes: {'class': 'login'},
- content: Messages.login_login
- });
- options.push({
- tag: 'a',
- attributes: {'class': 'register'},
- content: Messages.login_register
- });
- }
- var $icon = $('', {'class': 'fa fa-user'});
- var $userbig = $('', {'class': 'big'}).append($displayedName.clone());
- var $userButton = $('').text('Settings'); //XXX
+ return $('
').text(Messages.settings_title);
};
var createInfoBlock = function (store) {
@@ -42,7 +44,7 @@ define([
var accountName = obj.login_name;
if (!accountName) { return; }
- var $label = $('', {'class': 'label'}).text('Account name:'); // XXX
+ var $label = $('', {'class': 'label'}).text(Messages.login_username_label);
var $name = $('').text(accountName);
$div.append($label).append($name);
@@ -53,13 +55,13 @@ define([
var createDisplayNameInput = function (store) {
var obj = store.proxy;
var $div = $('