summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-10-28 16:01:50 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-10-28 16:02:05 -0400
commit60e5054ae8bd5e85e6116e52a3de311c71b8b453 (patch)
tree19eef225eba53bc1184b699e752d26cd6e7183cf /core/js
parentf3971e659b51dfe9e351274f63ce525a23806dab (diff)
downloadnextcloud-server-60e5054ae8bd5e85e6116e52a3de311c71b8b453.tar.gz
nextcloud-server-60e5054ae8bd5e85e6116e52a3de311c71b8b453.zip
Fix shared status icons
Diffstat (limited to 'core/js')
-rw-r--r--core/js/share.js40
1 files changed, 33 insertions, 7 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 00e5ef3eed6..c9b3a4288ac 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -10,17 +10,43 @@ OC.Share={
// Load all share icons
$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) {
if (result && result.status === 'success') {
- $.each(result.data, function(item, hasPrivateLink) {
- // Private links override shared in terms of icon display
+ $.each(result.data, function(item, hasLink) {
+ OC.Share.statuses[item] = hasLink;
+ // Links override shared in terms of icon display
+ if (hasLink) {
+ var image = OC.imagePath('core', 'actions/public');
+ } else {
+ var image = OC.imagePath('core', 'actions/shared');
+ }
if (itemType != 'file' && itemType != 'folder') {
- if (hasPrivateLink) {
- var image = OC.imagePath('core', 'actions/public');
+ $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
+ } else {
+ var dir = $('#dir').val();
+ if ($('#dir').val().length > 1) {
+ console.log(item);
+ var last = '';
+ var path = dir;
+ // Search for possible parent folders that are shared
+ while (path != last) {
+ if (path == item) {
+ var img = $('.fileactions .action').filterAttr('data-action', 'Share').find('img');
+ if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
+ img.attr('src', image);
+ }
+ }
+ last = path;
+ path = OC.Share.dirname(path);
+ }
} else {
- var image = OC.imagePath('core', 'actions/shared');
+ var file = $('tr').filterAttr('data-file', OC.basename(item));
+ if (file.length > 0) {
+ var img = $(file).find('.fileactions .action').filterAttr('data-action', 'Share').find('img');
+ if (img.attr('src') != OC.imagePath('core', 'actions/public')) {
+ img.attr('src', image);
+ }
+ }
}
- $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
}
- OC.Share.statuses[item] = hasPrivateLink;
});
}
});