summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-19 15:20:44 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-30 10:06:29 +0200
commit60bcdc550e95fbf0104bbc9c8028777016d73663 (patch)
treed6ca8475d7ea4cb8aa7e034add8902926171e612 /core
parent279ede33af09c43e03f97458c7fa673ff2b7982a (diff)
downloadnextcloud-server-60bcdc550e95fbf0104bbc9c8028777016d73663.tar.gz
nextcloud-server-60bcdc550e95fbf0104bbc9c8028777016d73663.zip
Fixed file actions for sharing views
FileActions can now be clone to be use for separate file list views without having the side-effect of affecting the main file list view. Added "Open" action in sharing overview file lists to redirect to the regular file list when clicking on a folder.
Diffstat (limited to 'core')
-rw-r--r--core/js/share.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/core/js/share.js b/core/js/share.js
index d013f257579..279b1d11663 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -10,8 +10,11 @@ OC.Share={
* Loads ALL share statuses from server, stores them in OC.Share.statuses then
* calls OC.Share.updateIcons() to update the files "Share" icon to "Shared"
* according to their share status and share type.
+ *
+ * @param itemType item type
+ * @param fileList file list instance, defaults to OCA.Files.App.fileList
*/
- loadIcons:function(itemType) {
+ loadIcons:function(itemType, fileList) {
// Load all share icons
$.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemsSharedStatuses', itemType: itemType }, function(result) {
if (result && result.status === 'success') {
@@ -19,7 +22,7 @@ OC.Share={
$.each(result.data, function(item, data) {
OC.Share.statuses[item] = data;
});
- OC.Share.updateIcons(itemType);
+ OC.Share.updateIcons(itemType, fileList);
}
});
},
@@ -27,9 +30,18 @@ OC.Share={
* Updates the files' "Share" icons according to the known
* sharing states stored in OC.Share.statuses.
* (not reloaded from server)
+ *
+ * @param itemType item type
+ * @param fileList file list instance or file list jQuery element,
+ * defaults to OCA.Files.App.fileList
*/
- updateIcons:function(itemType){
+ updateIcons:function(itemType, fileList){
var item;
+ var $fileList = (fileList || OCA.Files.App.fileList);
+ // in case the jQuery element was passed instead
+ if ($fileList.$fileList) {
+ $fileList = $fileList.$fileList;
+ }
for (item in OC.Share.statuses){
var data = OC.Share.statuses[item];
@@ -41,9 +53,9 @@ OC.Share={
var image = OC.imagePath('core', 'actions/shared');
}
if (itemType != 'file' && itemType != 'folder') {
- $('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
+ $fileList.find('a.share[data-item="'+item+'"]').css('background', 'url('+image+') no-repeat center');
} else {
- var file = $('tr[data-id="'+item+'"]');
+ var file = $fileList.find('tr[data-id="'+item+'"]');
if (file.length > 0) {
var action = $(file).find('.fileactions .action[data-action="Share"]');
var img = action.find('img').attr('src', image);
@@ -57,7 +69,7 @@ OC.Share={
// Search for possible parent folders that are shared
while (path != last) {
if (path == data['path'] && !data['link']) {
- var actions = $('.fileactions .action[data-action="Share"]');
+ var actions = $fileList.find('.fileactions .action[data-action="Share"]');
$.each(actions, function(index, action) {
var img = $(action).find('img');
if (img.attr('src') != OC.imagePath('core', 'actions/public')) {