From 9998700e7c9e8bccc901e21214a863f1aea86344 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sun, 13 Aug 2017 15:39:48 +0200 Subject: Show avatar instead of username for shared files Signed-off-by: Jan-Christoph Borchardt --- apps/files/css/files.scss | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps') diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index c03b1ce6fad..1fc38f03672 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -555,6 +555,10 @@ a.action > img { #fileList a.action.action-share { padding: 17px 14px; } +#fileList a.action.action-share .avatar { + display: inline-block; + vertical-align: middle; +} #fileList a.action.action-menu { padding-top: 17px; -- cgit v1.2.3 From f1d90adb09bc48b0c7be22968aaa2594fa9bae24 Mon Sep 17 00:00:00 2001 From: Marin Treselj Date: Thu, 21 Sep 2017 14:04:23 +0200 Subject: Fix CSS, better handling of recipients Signed-off-by: Marin Treselj --- apps/files/css/files.scss | 4 ++-- core/js/share.js | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'apps') diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 1fc38f03672..80a95559b2c 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -594,8 +594,8 @@ a.action > img { max-width: 70px; overflow: hidden; text-overflow: ellipsis; - vertical-align: bottom; - padding-left: 6px; + vertical-align: middle; + margin-left: 6px; } #fileList .favorite-mark.permanent { diff --git a/core/js/share.js b/core/js/share.js index fd21a25a2d8..35214fb11b8 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -203,11 +203,13 @@ OC.Share = _.extend(OC.Share || {}, { * @param {String} remoteAddress full remote share * @return {String} HTML code to display */ - _formatRemoteShare: function(remoteAddress) { + _formatRemoteShare: function(remoteAddress, message) { var parts = this._REMOTE_OWNER_REGEXP.exec(remoteAddress); if (!parts) { - // display as is, most likely to be a simple owner name - return '' + t('core', 'Shared by {recipient}', {recipient: escapeHTML(remoteAddress)}) + ''; + // display avatar of the user + var avatar = ''; + var hidden = '' + message + escapeHTML(remoteAddress) + ''; + return avatar + hidden; } var userName = parts[1]; @@ -243,7 +245,7 @@ OC.Share = _.extend(OC.Share || {}, { _formatShareList: function(recipients) { var _parent = this; return $.map(recipients, function(recipient) { - recipient = _parent._formatRemoteShare(recipient); + recipient = _parent._formatRemoteShare(recipient, t('core', 'Shared with ')); return recipient; }); }, @@ -259,8 +261,7 @@ OC.Share = _.extend(OC.Share || {}, { var action = $tr.find('.fileactions .action[data-action="Share"]'); var type = $tr.data('type'); var icon = action.find('.icon'); - var message; - var recipients; + var message, recipients, avatars; var owner = $tr.attr('data-share-owner'); var shareFolderIcon; var iconClass = 'icon-shared'; @@ -297,12 +298,12 @@ OC.Share = _.extend(OC.Share || {}, { message = t('core', 'Shared'); // even if reshared, only show "Shared by" if (owner) { - message = this._formatRemoteShare(owner); + message = t('core', 'Shared by '); + avatars = this._formatRemoteShare(owner, message); + } else if (recipients) { + avatars = this._formatShareList(recipients.split(", ")).join(""); } - else if (recipients) { - message = t('core', 'Shared with {recipients}', {recipients: this._formatShareList(recipients.split(", ")).join(", ")}, 0, {escape: false}); - } - action.html(' ' + message + '').prepend(icon); + action.html(avatars).prepend(icon); if (owner || recipients) { var avatarElement = action.find('.avatar'); -- cgit v1.2.3 From 9407f6c1d08b95bbbd751c372c0e571b1e2e1c15 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 1 Nov 2017 11:41:22 +0100 Subject: Fix test for tooltip and local share owner Signed-off-by: Jan-Christoph Borchardt --- apps/files/css/files.scss | 4 ++++ core/js/share.js | 5 ++--- core/js/tests/specs/shareSpec.js | 5 ++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'apps') diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 80a95559b2c..c165063bb85 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -598,6 +598,10 @@ a.action > img { margin-left: 6px; } +#fileList .remoteAddress .userDomain { + margin-left: 0 !important; +} + #fileList .favorite-mark.permanent { opacity: 1; } diff --git a/core/js/share.js b/core/js/share.js index 240fc0fb761..c629fb01da4 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -301,16 +301,15 @@ OC.Share = _.extend(OC.Share || {}, { message = t('core', 'Shared by '); avatars = this._formatRemoteShare(owner, message); } else if (recipients) { - avatars = this._formatShareList(recipients.split(", ")).join(""); + avatars = this._formatShareList(recipients.split(', ')).join(''); } action.html(avatars).prepend(icon); if (owner || recipients) { var avatarElement = action.find('.avatar'); avatarElement.avatar(avatarElement.data('username'), 32); - avatarElement.tooltip({placement: 'top'}); - action.find('.remoteAddress').tooltip({placement: 'top'}); + action.find('.icon-shared + span').tooltip({placement: 'top'}); } } else { action.html('' + t('core', 'Shared') + '').prepend(icon); diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index fbf6eecc8df..cef0d57fc6a 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -58,8 +58,8 @@ describe('OC.Share tests', function() { tooltipStub.reset(); } - it('displays the local share owner as is', function() { - checkOwner('User One', 'User One', null); + it('displays the local share owner with "Shared by" prefix', function() { + checkOwner('User One', 'Shared by User One', null); }); it('displays the user name part of a remote share owner', function() { checkOwner( @@ -240,4 +240,3 @@ describe('OC.Share tests', function() { }); }); }); - -- cgit v1.2.3 From 222d99fe961718f267cd092206698b8f6a0f77d7 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 2 Nov 2017 13:51:08 +0100 Subject: adjust more js unit tests Signed-off-by: Arthur Schiwon --- apps/files_sharing/tests/js/shareSpec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'apps') diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js index ea2f427df75..5b0a78c9c64 100644 --- a/apps/files_sharing/tests/js/shareSpec.js +++ b/apps/files_sharing/tests/js/shareSpec.js @@ -145,7 +145,7 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.find('>span').text().trim()).toEqual('User One'); + expect($action.find('>span').text().trim()).toEqual('Shared by User One'); expect($action.find('.icon').hasClass('icon-shared')).toEqual(true); expect($action.find('.icon').hasClass('icon-public')).toEqual(false); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg'); @@ -166,7 +166,7 @@ describe('OCA.Sharing.Util tests', function() { }]); $tr = fileList.$el.find('tbody tr:first'); $action = $tr.find('.action-share'); - expect($action.find('>span').text().trim()).toEqual('Shared with User One, User Two'); + expect($action.text().trim()).toEqual('Shared with User One Shared with User Two'); expect($action.find('.icon').hasClass('icon-shared')).toEqual(true); expect($action.find('.icon').hasClass('icon-public')).toEqual(false); expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg'); @@ -273,7 +273,7 @@ describe('OCA.Sharing.Util tests', function() { expect($tr.attr('data-share-recipients')).toEqual('Group One, Group Two, User One, User Two'); - expect($action.find('>span').text().trim()).toEqual('Shared with Group One, Group Two, User One, User Two'); + expect($action.text().trim()).toEqual('Shared with Group One Shared with Group Two Shared with User One Shared with User Two'); expect($action.find('.icon').hasClass('icon-shared')).toEqual(true); expect($action.find('.icon').hasClass('icon-public')).toEqual(false); }); @@ -306,7 +306,7 @@ describe('OCA.Sharing.Util tests', function() { expect($tr.attr('data-share-recipients')).toEqual('User One, User Three, User Two'); - expect($action.find('>span').text().trim()).toEqual('Shared with User One, User Three, User Two'); + expect($action.text().trim()).toEqual('Shared with User One Shared with User Three Shared with User Two'); expect($action.find('.icon').hasClass('icon-shared')).toEqual(true); expect($action.find('.icon').hasClass('icon-public')).toEqual(false); }); @@ -362,7 +362,7 @@ describe('OCA.Sharing.Util tests', function() { expect($tr.attr('data-share-recipients')).toEqual('User Two'); - expect($action.find('>span').text().trim()).toEqual('User One'); + expect($action.find('>span').text().trim()).toEqual('Shared by User One'); expect($action.find('.icon').hasClass('icon-shared')).toEqual(true); expect($action.find('.icon').hasClass('icon-public')).toEqual(false); }); @@ -393,7 +393,7 @@ describe('OCA.Sharing.Util tests', function() { expect($tr.attr('data-share-recipients')).not.toBeDefined(); - expect($action.find('>span').text().trim()).toEqual('User One'); + expect($action.find('>span').text().trim()).toEqual('Shared by User One'); expect($action.find('.icon').hasClass('icon-shared')).toEqual(true); expect($action.find('.icon').hasClass('icon-public')).toEqual(false); }); -- cgit v1.2.3