[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon May 29 04:46:18 UTC 2017


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

New commits:
commit d0ac8a4b969d05d474170b2d06d601d54eb8ab26
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>

diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index 18c996bf..801e7b58 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -1565,10 +1565,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;
@@ -1617,7 +1626,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 180da860..c809980e 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, UserExtraInfo: viewInfo.userextrainfo, 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