Replace the username button by a dropdown menu

This commit is contained in:
yflory
2017-01-13 16:42:30 +01:00
parent 4adde0f0c0
commit 2afdc11327
11 changed files with 167 additions and 87 deletions

View File

@@ -366,6 +366,14 @@ define([
var onInit = config.onInit = function (info) {
userList = info.userList;
module.userName = {};
// The lastName is stored in an object passed to the toolbar so that when the user clicks on
// the "change display name" button, the prompt already knows his current name
getLastName(function (err, lastName) {
module.userName.lastName = lastName;
});
var config = {
userData: userData,
readOnly: readOnly,
@@ -375,6 +383,10 @@ define([
defaultName: defaultName,
suggestName: suggestName
},
userName: {
setName: setName,
lastName: module.userName
},
common: Cryptpad
};
if (readOnly) {delete config.changeNameID; }
@@ -392,15 +404,6 @@ define([
editHash = Cryptpad.getEditHashFromKeys(info.channel, secret.keys);
}
// Store the object sent for the "change username" button so that we can update the field value correctly
var userNameButtonObject = module.userName = {};
/* add a "change username" button */
getLastName(function (err, lastName) {
userNameButtonObject.lastName = lastName;
var $username = module.$userNameButton = Cryptpad.createButton('username', false, userNameButtonObject, setName).hide();
$userBlock.append($username);
});
/* add an export button */
var $export = Cryptpad.createButton('export', true, {}, exportText);
$rightside.append($export);