From d2389a5729600429cd6ec3099e12948c8b4a3e5d Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 11 Oct 2016 18:39:43 +0200 Subject: [PATCH 1/3] Change the userlist in the toolbar --- customize.dist/translations/messages.fr.js | 14 ++--- customize.dist/translations/messages.js | 14 ++--- www/common/toolbar.js | 67 +++++++++++++--------- 3 files changed, 50 insertions(+), 45 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index df9deb63c..f5fe9b09f 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -17,21 +17,17 @@ define(function () { out.common_connectionLost = 'Connexion au serveur perdue'; - out.editingAlone = 'Pas d\'autre participant'; - out.editingWithOneOtherPerson = 'Édition avec une autre personne'; - out.editingWith = 'Édition avec'; - out.otherPeople = 'autres personnes'; out.disconnected = 'Déconnecté'; out.synchronizing = 'Synchronisation'; out.reconnecting = 'Reconnexion...'; out.lag = 'Latence'; out.readonly = 'Lecture seule'; - out.nobodyIsEditing = "Personne n'édite le document"; - out.onePersonIsEditing = 'Une personne édite le document'; - out.peopleAreEditing = '{0} personnes éditent le document'; - out.oneViewer = '1 lecteur'; - out.viewers = '{0} lecteurs'; out.anonymous = "Vous êtes actuellement anonyme"; + out.yourself = "Vous-même"; + out.anonymousUsers = "utilisateurs anonymes"; + out.anonymousUser = "utilisateur anonyme"; + out.viewUsersIcon = "UTILISATEURS EN LECTURE SEULE"; + out.editUsersIcon = "UTILISATEURS ÉDITANT LE DOCUMENT"; out.greenLight = "Tout fonctionne bien"; out.orangeLight = "Votre connexion est lente, ce qui réduit la qualité de l'éditeur"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index d46fb6e5a..d4651ffb2 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -17,21 +17,17 @@ define(function () { out.common_connectionLost = 'Server Connection Lost'; - out.editingAlone = 'Editing alone'; - out.editingWithOneOtherPerson = 'Editing with one other person'; - out.editingWith = 'Editing with'; - out.otherPeople = 'other people'; out.disconnected = 'Disconnected'; out.synchronizing = 'Synchronizing'; out.reconnecting = 'Reconnecting...'; out.lag = 'Lag'; out.readonly = 'Read only'; - out.nobodyIsEditing = 'Nobody is editing'; - out.onePersonIsEditing = 'One person is editing'; - out.peopleAreEditing = '{0} people are editing'; - out.oneViewer = '1 viewer'; - out.viewers = '{0} viewers'; out.anonymous = "You are currently anonymous"; + out.yourself = "Yourself"; + out.anonymousUsers = "anonymous users"; + out.anonymousUser = "anonymous user"; + out.viewUsersIcon = "PEOPLE VIEWING"; + out.editUsersIcon = "PEOPLE EDITING"; out.greenLight = "Everything is working fine"; out.orangeLight = "Your slow connection may impact your experience"; diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 110f8cc9e..b500c6634 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -1,6 +1,7 @@ define([ '/customize/messages.js', '/bower_components/jquery/dist/jquery.min.js', + '/bower_components/bootstrap/js/dropdown.js', ], function (Messages) { var $ = window.jQuery; @@ -95,19 +96,17 @@ define([ var getOtherUsers = function(myUserName, userList, userData) { var i = 0; - var list = ''; + var list = []; userList.forEach(function(user) { if(user !== myUserName) { var data = (userData) ? (userData[user] || null) : null; var userName = (data) ? data.name : null; if(userName) { - if(i === 0) { list = ' : '; } - list += userName + ', '; - i++; + list.push(userName); } } }); - return (i > 0) ? list.slice(0, -2) : list; + return list; }; var arrayIntersect = function(a, b) { @@ -131,34 +130,48 @@ define([ userList = readOnly === -1 ? userList : arrayIntersect(userList, Object.keys(userData)); var innerHTML; var numberOfViewUsers = numberOfUsers - userList.length; + var editUsersNames = getOtherUsers(myUserName, userList, userData); + var editTitle = Messages.editUsersIcon; + var anonymous = numberOfUsers - editUsersNames.length; + + // Display the user list in the title property of the "edit users" icon. + if (readOnly === 0) { + editTitle += '\n' + Messages.yourself; + anonymous--; + } + if (editUsersNames.length > 0) { + editTitle += '\n' + editUsersNames.join('\n'); + } + if (anonymous > 0) { + var text = anonymous === 1 ? Messages.anonymousUser : Messages.anonymousUsers; + editTitle += '\n' + anonymous + " " + text; + } + + var $editIcon = $('