diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-29 15:40:15 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-29 15:40:15 +0100 |
commit | 774d069ff08e21ecdac1fceec80e162f5917105e (patch) | |
tree | 46344b8906afe533e629d46d3de7107a5629de94 /core | |
parent | 1ce911d2f994d105660598ce518b02238502258f (diff) | |
parent | 9c9158e6b78c69835cb7280810819fb2cd6f84f7 (diff) | |
download | nextcloud-server-774d069ff08e21ecdac1fceec80e162f5917105e.tar.gz nextcloud-server-774d069ff08e21ecdac1fceec80e162f5917105e.zip |
Merge pull request #20122 from owncloud/files-consolidateiconupdate
Fix icon update to be more consistent
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() { |