diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-10-28 17:43:36 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-10-29 12:59:51 +0100 |
commit | 9c9158e6b78c69835cb7280810819fb2cd6f84f7 (patch) | |
tree | 8045f5e8fb80aa377c68d7ba7f0ac498b2475c72 /core | |
parent | 92e63a802c9324ccfcd716bb0461f5b7cc153549 (diff) | |
download | nextcloud-server-9c9158e6b78c69835cb7280810819fb2cd6f84f7.tar.gz nextcloud-server-9c9158e6b78c69835cb7280810819fb2cd6f84f7.zip |
Fix icon update to be more consistent
Makes the details bar show the same icon as in the list.
Diffstat (limited to 'core')
-rw-r--r-- | core/js/mimetype.js | 2 | ||||
-rw-r--r-- | core/js/share.js | 17 | ||||
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 7 |
3 files changed, 23 insertions, 3 deletions
diff --git a/core/js/mimetype.js b/core/js/mimetype.js index b0de8eb8411..3cc33ce2830 100644 --- a/core/js/mimetype.js +++ b/core/js/mimetype.js @@ -46,6 +46,8 @@ OC.MimeType = { return 'folder'; } else if (mimeType === 'dir-shared' && $.inArray('folder-shared', files) !== -1) { return 'folder-shared'; + } else if (mimeType === 'dir-public' && $.inArray('folder-public', files) !== -1) { + return 'folder-public'; } else if (mimeType === 'dir-external' && $.inArray('folder-external', files) !== -1) { return 'folder-external'; } else if ($.inArray(icon, files) !== -1) { diff --git a/core/js/share.js b/core/js/share.js index 1131ae8f112..e14e19a2543 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -253,14 +253,25 @@ OC.Share = _.extend(OC.Share || {}, { // update folder icon if (type === 'dir' && (hasShares || hasLink || owner)) { if (hasLink) { - shareFolderIcon = OC.imagePath('core', 'filetypes/folder-public'); + shareFolderIcon = OC.MimeType.getIconUrl('dir-public'); } else { - shareFolderIcon = OC.imagePath('core', 'filetypes/folder-shared'); + shareFolderIcon = OC.MimeType.getIconUrl('dir-shared'); } $tr.find('.filename .thumbnail').css('background-image', 'url(' + shareFolderIcon + ')'); + $tr.attr('data-icon', shareFolderIcon); } else if (type === 'dir') { - shareFolderIcon = OC.imagePath('core', 'filetypes/folder'); + var mountType = $tr.attr('data-mounttype'); + // FIXME: duplicate of FileList._createRow logic for external folder, + // need to refactor the icon logic into a single code path eventually + if (mountType && mountType.indexOf('external') === 0) { + shareFolderIcon = OC.MimeType.getIconUrl('dir-external'); + $tr.attr('data-icon', shareFolderIcon); + } else { + shareFolderIcon = OC.MimeType.getIconUrl('dir'); + // back to default + $tr.removeAttr('data-icon'); + } $tr.find('.filename .thumbnail').css('background-image', 'url(' + shareFolderIcon + ')'); } // update share action text / icon diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index 9e80f4fe19d..5c76ea600b8 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -142,6 +142,13 @@ describe('OC.Share tests', function() { checkIcon('filetypes/folder-public'); }); + it('shows external storage icon if external mount point', function() { + $file.attr('data-type', 'dir'); + $file.attr('data-mountType', 'external'); + OC.Share.markFileAsShared($file, false, false); + + checkIcon('filetypes/folder-external'); + }); }); describe('displaying the recipoients', function() { |