[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/dist loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu Jun 1 09:47:56 UTC 2017


 loleaflet/dist/toolbar/toolbar.js |   17 +++++++++++++----
 loleaflet/src/map/Map.js          |    2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 82002362ba92ae9e596cc7f490e6a76b890e7dee
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun May 28 17:47:53 2017 -0400

    loleaflet: add user avatar to useritem
    
    Change-Id: I0b366ab4b92fb9b1d5f7aa0ea6fe51ac9897bdce
    Reviewed-on: https://gerrit.libreoffice.org/38121
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit d0ac8a4b969d05d474170b2d06d601d54eb8ab26)
    Reviewed-on: https://gerrit.libreoffice.org/38139
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index ba7aa208..833b13d7 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -1550,10 +1550,19 @@ function onUseritemClicked(e) {
 	}
 }
 
-function getUserItem(viewId, userName, color) {
+function getUserItem(viewId, userName, extraInfo, color) {
 	var html = '<tr class="useritem" id="user-' + viewId + '" onclick="onUseritemClicked(event)">' +
-	             '<td class=usercolor style="background-color: ' + color  +';"></td>' +
-	             '<td class="username loleaflet-font">' + userName + '</td>' +
+	             '<td class=usercolor style="background-color: ' + color  +';';
+	if (extraInfo !== undefined && 'avatar' in extraInfo[0]) {
+		html += 'top=0px ! important;"> <img src="' + extraInfo[0].avatar + '" width="32" height="32" />'
+	}
+	else {
+		html += '">';
+	}
+
+	// TODO: Add mail and other links as sub-menu.
+	html += '</td>' +
+	             '<td class="username loleaflet-font" >' + userName + '</td>' +
 	    '</tr>';
 
 	return html;
@@ -1602,7 +1611,7 @@ map.on('addview', function(e) {
 	}
 
 	var userlistItem = w2ui['toolbar-down'].get('userlist');
-	var newhtml = $(userlistItem.html).find('#userlist_table tbody').append(getUserItem(e.viewId, username, color)).parent().parent()[0].outerHTML;
+	var newhtml = $(userlistItem.html).find('#userlist_table tbody').append(getUserItem(e.viewId, username, e.extraInfo, color)).parent().parent()[0].outerHTML;
 	userlistItem.html = newhtml;
 	updateUserListCount();
 });
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 090bafab..65575f0d 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -163,7 +163,7 @@ L.Map = L.Evented.extend({
 		this.fire('postMessage', {msgId: 'View_Added', args: {ViewId: viewInfo.id, UserId: viewInfo.userid, UserName: viewInfo.username, Color: viewInfo.color, ReadOnly: viewInfo.readonly}});
 
 		// Fire last, otherwise not all events are handled correctly.
-		this.fire('addview', {viewId: viewInfo.id, username: viewInfo.username, readonly: this.isViewReadOnly(viewInfo.id)});
+		this.fire('addview', {viewId: viewInfo.id, username: viewInfo.username, extraInfo: viewInfo.userextrainfo, readonly: this.isViewReadOnly(viewInfo.id)});
 	},
 
 	removeView: function(viewid) {


More information about the Libreoffice-commits mailing list