diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-19 01:44:15 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-19 01:44:15 -0400 |
commit | 518ca0ac58c7cf762d0fc51f75cc886cedd495b0 (patch) | |
tree | 491bbee1c0d24b069fdfd32b16805b001e3e784d /core | |
parent | 1e1e8ae3b52378105aa0523466dccb1dafd9c650 (diff) | |
download | nextcloud-server-518ca0ac58c7cf762d0fc51f75cc886cedd495b0.tar.gz nextcloud-server-518ca0ac58c7cf762d0fc51f75cc886cedd495b0.zip |
Fix changing of share status icons, bug fix for oc-1631
Diffstat (limited to 'core')
-rw-r--r-- | core/js/share.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/core/js/share.js b/core/js/share.js index d77f3da6842..b4ca6892c68 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -35,21 +35,29 @@ OC.Share={ } } var shares = false; + var link = false; + var image = OC.imagePath('core', 'actions/share'); $.each(OC.Share.itemShares, function(index) { - if (OC.Share.itemShares[index].length > 0) { - shares = true; - return; + if (OC.Share.itemShares[index]) { + if (index == OC.Share.SHARE_TYPE_LINK) { + if (OC.Share.itemShares[index] == true) { + shares = true; + image = OC.imagePath('core', 'actions/public'); + link = true; + return; + } + } else if (OC.Share.itemShares[index].length > 0) { + shares = true; + image = OC.imagePath('core', 'actions/shared'); + } } }); + if (itemType != 'file' && itemType != 'folder') { + $('a.share[data-item="'+itemSource+'"]').css('background', 'url('+image+') no-repeat center'); + } if (shares) { - $('a.share[data-item="'+itemSource+'"]').css('background', 'url('+OC.imagePath('core', 'actions/shared')+') no-repeat center'); - if (typeof OC.Share.statuses[itemSource] === 'undefined') { - OC.Share.statuses[itemSource] = false; - } + OC.Share.statuses[itemSource] = link; } else { - if (itemType != 'file' && itemType != 'folder') { - $('a.share[data-item="'+itemSource+'"]').css('background', 'url('+OC.imagePath('core', 'actions/share')+') no-repeat center'); - } delete OC.Share.statuses[itemSource]; } }, @@ -287,6 +295,7 @@ OC.Share={ } }, showLink:function(itemSource, password) { + OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = true; $('#linkCheckbox').attr('checked', true); var filename = $('tr').filterAttr('data-id', String(itemSource)).data('file'); if ($('#dir').val() == '/') { @@ -421,12 +430,14 @@ $(document).ready(function() { // Create a link OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ, function() { OC.Share.showLink(itemSource); - // TODO Change icon + OC.Share.updateIcon(itemType, itemSource); }); } else { // Delete private link OC.Share.unshare(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', function() { OC.Share.hideLink(); + OC.Share.itemShares[OC.Share.SHARE_TYPE_LINK] = false; + OC.Share.updateIcon(itemType, itemSource); if (typeof OC.Share.statuses[itemSource] === 'undefined') { $('#expiration').hide(); } |