diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index e1d8b60d31..38f5bab6f7 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -81,7 +81,7 @@ var FileActions = { event.data.actionFunc(file); }; - $.each(actions, function (name, action) { + var addAction = function (name, action) { // NOTE: Temporary fix to prevent rename action in root of Shared directory if (name === 'Rename' && $('#dir').val() === '/Shared') { return true; @@ -92,7 +92,7 @@ var FileActions = { if (img.call) { img = img(file); } - var html = ''; + var html = ''; if (img) { html += ' '; } @@ -101,18 +101,27 @@ var FileActions = { var element = $(html); element.data('action', name); //alert(element); - element.on('click',{a:null, elem:parent, actionFunc:actions[name]},actionHandler); + element.on('click', {a: null, elem: parent, actionFunc: actions[name]}, actionHandler); parent.find('a.name>span.fileactions').append(element); } + }; + + $.each(actions, function (name, action) { + if (name !== 'Share') { + addAction(name, action); + } }); + if(actions.Share){ + addAction('Share', actions.Share); + } if (actions['Delete']) { var img = FileActions.icons['Delete']; if (img.call) { img = img(file); } - if (typeof trashBinApp !== 'undefined' && trashBinApp) { + if (typeof trashBinApp !== 'undefined' && trashBinApp) { var html = ''; } else { var html = ''; @@ -122,7 +131,7 @@ var FileActions = { element.append($('')); } element.data('action', actions['Delete']); - element.on('click',{a:null, elem:parent, actionFunc:actions['Delete']},actionHandler); + element.on('click', {a: null, elem: parent, actionFunc: actions['Delete']}, actionHandler); parent.parent().children().last().append(element); } }, @@ -146,7 +155,7 @@ $(document).ready(function () { } else { var downloadScope = 'file'; } - + if (typeof disableDownloadActions == 'undefined' || !disableDownloadActions) { FileActions.register(downloadScope, 'Download', OC.PERMISSION_READ, function () { return OC.imagePath('core', 'actions/download'); @@ -154,11 +163,11 @@ $(document).ready(function () { window.location = OC.filePath('files', 'ajax', 'download.php') + '?files=' + encodeURIComponent(filename) + '&dir=' + encodeURIComponent($('#dir').val()); }); } - - $('#fileList tr').each(function(){ + + $('#fileList tr').each(function () { FileActions.display($(this).children('td.filename')); }); - + }); FileActions.register('all', 'Delete', OC.PERMISSION_DELETE, function () {