[Libreoffice-commits] online.git: Branch 'private/kendy/mobile' - 2 commits - loleaflet/css loleaflet/images loleaflet/js
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Nov 16 15:59:23 UTC 2018
loleaflet/css/toolbar.css | 1
loleaflet/images/lc_calloutshapes-black.svg | 6 --
loleaflet/js/toolbar.js | 73 ++++++++++++++++++++++++----
3 files changed, 64 insertions(+), 16 deletions(-)
New commits:
commit 23e752ccca23de3877c9e80eb6e59c723f3661b8
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 16 15:20:33 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 16 16:58:14 2018 +0100
mobile: Various fixes to the user list, particularly on mobile.
Change-Id: Iee294630c2af5240394a848bbce0156d691ef7a0
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index b62b08a16..0b293580b 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -724,7 +724,16 @@ function initMobileToolbar(toolItems) {
{type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true},
{type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true},
{type: 'button', id: 'fullscreen', img: 'fullscreen', hint: _UNO('.uno:FullScreen', 'text')},
- {type: 'button', id: 'users', img: 'users'},
+ {type: 'drop', id: 'userlist', img: 'users', html: '<div id="userlist_container"><table id="userlist_table"><tbody></tbody></table>' +
+ '<hr><table class="loleaflet-font" id="editor-btn">' +
+ '<tr>' +
+ '<td><input type="checkbox" name="alwaysFollow" id="follow-checkbox" onclick="editorUpdate(event)"></td>' +
+ '<td>' + _('Always follow the editor') + '</td>' +
+ '</tr>' +
+ '</table>' +
+ '<p id="currently-msg">' + _('Current') + ' - <b><span id="current-editor"></span></b></p>' +
+ '</div>'
+ },
],
onClick: function (e) {
onClick(e, e.target);
@@ -1088,6 +1097,7 @@ function initNormalToolbar(toolItems) {
}
var userJoinedPopupMessage = '<div>' + _('%user has joined') + '</div>';
+var userLeftPopupMessage = '<div>' + _('%user has left') + '</div>';
var userPopupTimeout = null;
function localizeStateTableCell (text) {
@@ -2033,12 +2043,13 @@ function onUseritemClicked(e) { // eslint-disable-line no-unused-vars
selectUser(viewId);
}
+global.onUseritemClicked = onUseritemClicked;
+
function editorUpdate(e) { // eslint-disable-line no-unused-vars
var docLayer = map._docLayer;
if (e.target.checked) {
var editorId = docLayer._editorId;
- var userlistItem = w2ui['toolbar-down'].get('userlist');
docLayer._followUser = false;
docLayer._followEditor = true;
@@ -2047,9 +2058,12 @@ function editorUpdate(e) { // eslint-disable-line no-unused-vars
docLayer._followThis = editorId;
}
- $('.selected-user').removeClass('selected-user');
- if ($(userlistItem.html).find('.selected-user').length !== 0)
- userlistItem.html = $(userlistItem.html).find('.selected-user').removeClass('selected-user').parent().parent().parent()[0].outerHTML;
+ var userlistItem = w2ui['toolbar-down'].get('userlist');
+ if (userlistItem !== null) {
+ $('.selected-user').removeClass('selected-user');
+ if ($(userlistItem.html).find('.selected-user').length !== 0)
+ userlistItem.html = $(userlistItem.html).find('.selected-user').removeClass('selected-user').parent().parent().parent()[0].outerHTML;
+ }
}
else {
docLayer._followEditor = false;
@@ -2058,14 +2072,24 @@ function editorUpdate(e) { // eslint-disable-line no-unused-vars
$('#tb_toolbar-down_item_userlist').w2overlay('');
}
+global.editorUpdate = editorUpdate;
+
function selectUser(viewId) {
var userlistItem = w2ui['toolbar-down'].get('userlist');
+ if (userlistItem === null) {
+ return;
+ }
+
userlistItem.html = $(userlistItem.html).find('#user-' + viewId).addClass('selected-user').parent().parent().parent()[0].outerHTML;
$('#tb_toolbar-down_item_userlist').w2overlay('');
}
function deselectUser(viewId) {
var userlistItem = w2ui['toolbar-down'].get('userlist');
+ if (userlistItem === null) {
+ return;
+ }
+
userlistItem.html = $(userlistItem.html).find('#user-' + viewId).removeClass('selected-user').parent().parent().parent()[0].outerHTML;
}
@@ -2091,6 +2115,10 @@ function getUserItem(viewId, userName, extraInfo, color) {
function updateUserListCount() {
var userlistItem = w2ui['toolbar-down'].get('userlist');
+ if (userlistItem === null) {
+ return;
+ }
+
var count = $(userlistItem.html).find('#userlist_table tbody tr').length;
if (count > 1) {
userlistItem.text = nUsers.replace('%n', count);
@@ -2132,9 +2160,11 @@ function onAddView(e) {
}
var userlistItem = w2ui['toolbar-down'].get('userlist');
- var newhtml = $(userlistItem.html).find('#userlist_table tbody').append(getUserItem(e.viewId, username, e.extraInfo, color)).parent().parent()[0].outerHTML;
- userlistItem.html = newhtml;
- updateUserListCount();
+ if (userlistItem !== null) {
+ var newhtml = $(userlistItem.html).find('#userlist_table tbody').append(getUserItem(e.viewId, username, e.extraInfo, color)).parent().parent()[0].outerHTML;
+ userlistItem.html = newhtml;
+ updateUserListCount();
+ }
}
$(window).resize(function() {
@@ -2247,6 +2277,32 @@ function setupToolbar(e) {
}
});
+ map.on('removeview', function(e) {
+ $('#tb_toolbar-down_item_userlist')
+ .w2overlay({
+ class: 'loleaflet-font',
+ html: userLeftPopupMessage.replace('%user', e.username),
+ style: 'padding: 5px'
+ });
+ clearTimeout(userPopupTimeout);
+ userPopupTimeout = setTimeout(function() {
+ $('#tb_toolbar-down_item_userlist').w2overlay('');
+ clearTimeout(userPopupTimeout);
+ userPopupTimeout = null;
+ }, 3000);
+
+ if (e.viewId === map._docLayer._followThis) {
+ map._docLayer._followThis = -1;
+ map._docLayer._followUser = false;
+ }
+
+ var userlistItem = w2ui['toolbar-down'].get('userlist');
+ if (userlistItem !== null) {
+ userlistItem.html = $(userlistItem.html).find('#user-' + e.viewId).remove().end()[0].outerHTML;
+ updateUserListCount();
+ }
+ });
+
map.on('doclayerinit', onDocLayerInit);
map.on('wopiprops', onWopiProps);
map.on('addview', onAddView);
commit f59646c8563b44b72b45a11a36e9a56bfcd0b217
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Fri Nov 16 15:00:37 2018 +0100
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri Nov 16 16:46:10 2018 +0100
mobile: Get rid of the callout icon.
Change-Id: I6a040269a2a0d45e7b2db00c4c221ff6c86fdf1e
diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css
index be03c514d..daef2d11c 100644
--- a/loleaflet/css/toolbar.css
+++ b/loleaflet/css/toolbar.css
@@ -582,7 +582,6 @@ button.leaflet-control-search-next
.w2ui-icon.specialcharacter{ background: url('images/lc_insertsymbol.svg') no-repeat center !important; }
.w2ui-icon.insertobjectchart{ background: url('images/lc_drawchart.svg') no-repeat center !important; }
.w2ui-icon.users{ background: url('images/contacts-dark.svg') no-repeat center !important; }
-.w2ui-icon.callout{ background: url('images/lc_calloutshapes-black.svg') no-repeat center !important; }
.w2ui-icon.fullscreen{ background: url('images/lc_fullscreen.svg') no-repeat center !important; }
.w2ui-icon.closemobile{ background: url('images/lc_closedocmobile.svg') no-repeat center !important; }
diff --git a/loleaflet/images/lc_calloutshapes-black.svg b/loleaflet/images/lc_calloutshapes-black.svg
deleted file mode 100644
index bd085cd95..000000000
--- a/loleaflet/images/lc_calloutshapes-black.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
- <path
- style="fill:#4d4d4d"
- d="M 6 4 C 4.8920104 4 4 4.8920001 4 6 L 4 14 C 4 15.108 4.8920104 16 6 16 L 8 16 L 8 20 L 12 16 L 18 16 C 19.10799 16 20 15.108 20 14 L 20 6 C 20 4.8920001 19.10799 4 18 4 L 6 4 z "
- />
- </svg>
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index e5488cbaf..b62b08a16 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -725,7 +725,6 @@ function initMobileToolbar(toolItems) {
{type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true},
{type: 'button', id: 'fullscreen', img: 'fullscreen', hint: _UNO('.uno:FullScreen', 'text')},
{type: 'button', id: 'users', img: 'users'},
- {type: 'button', id: 'callout', img: 'callout'},
],
onClick: function (e) {
onClick(e, e.target);
More information about the Libreoffice-commits
mailing list