diff --git a/core/js/share.js b/core/js/share.js index d77f3da684..b4ca6892c6 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(); }