diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-12-08 11:30:21 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-12-08 11:30:21 +0100 |
commit | d3188159d2f2aca64bdc2ec3c3eccfbbfb0b5725 (patch) | |
tree | f70960539b575768e3de1f4fac020ad1f5e37555 /apps/files_trashbin | |
parent | e6908f8b890414451dfc32af4d76562016d75d0f (diff) | |
parent | e689bc745fc94d9760976e40522ddf96eb5c645c (diff) | |
download | nextcloud-server-d3188159d2f2aca64bdc2ec3c3eccfbbfb0b5725.tar.gz nextcloud-server-d3188159d2f2aca64bdc2ec3c3eccfbbfb0b5725.zip |
Merge pull request #12394 from owncloud/files-fileactionsimprovements
Improve FileActions JS to allow for custom rendering
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/js/app.js | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js index a9727542bad..72d9f4a6771 100644 --- a/apps/files_trashbin/js/app.js +++ b/apps/files_trashbin/js/app.js @@ -57,21 +57,34 @@ OCA.Trashbin.App = { ); }, t('files_trashbin', 'Restore')); - fileActions.register('all', 'Delete', OC.PERMISSION_READ, function() { - return OC.imagePath('core', 'actions/delete'); - }, function(filename, context) { - var fileList = context.fileList; - $('.tipsy').remove(); - var tr = fileList.findFileEl(filename); - var deleteAction = tr.children("td.date").children(".action.delete"); - deleteAction.removeClass('icon-delete').addClass('icon-loading-small'); - fileList.disableActions(); - $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'), { - files: JSON.stringify([filename]), - dir: fileList.getCurrentDirectory() - }, - _.bind(fileList._removeCallback, fileList) - ); + fileActions.registerAction({ + name: 'Delete', + displayName: '', + mime: 'all', + permissions: OC.PERMISSION_READ, + icon: function() { + return OC.imagePath('core', 'actions/delete'); + }, + render: function(actionSpec, isDefault, context) { + var $actionLink = fileActions._makeActionLink(actionSpec, context); + $actionLink.attr('original-title', t('files', 'Delete permanently')); + context.$file.find('td:last').append($actionLink); + return $actionLink; + }, + actionHandler: function(filename, context) { + var fileList = context.fileList; + $('.tipsy').remove(); + var tr = fileList.findFileEl(filename); + var deleteAction = tr.children("td.date").children(".action.delete"); + deleteAction.removeClass('icon-delete').addClass('icon-loading-small'); + fileList.disableActions(); + $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'), { + files: JSON.stringify([filename]), + dir: fileList.getCurrentDirectory() + }, + _.bind(fileList._removeCallback, fileList) + ); + } }); return fileActions; } |