From baa5a69c55848aede39e14c936f837f77a221496 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 11 Dec 2015 15:14:30 +0100 Subject: Bring back file delete action text to be based on context For received shares, the delete action becomes "Unshare" and for personal mounts it becomes "Disconnect storage". This also makes it possible from now on to pass a function to a file action's "displayName" attribute. --- apps/files/js/fileactionsmenu.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'apps/files/js/fileactionsmenu.js') diff --git a/apps/files/js/fileactionsmenu.js b/apps/files/js/fileactionsmenu.js index 67cbb48c965..9e51d8f1f1f 100644 --- a/apps/files/js/fileactionsmenu.js +++ b/apps/files/js/fileactionsmenu.js @@ -81,6 +81,7 @@ * Renders the menu with the currently set items */ render: function() { + var self = this; var fileActions = this._context.fileActions; var actions = fileActions.getActions( fileActions.getCurrentMimeType(), @@ -100,6 +101,13 @@ (!defaultAction || actionSpec.name !== defaultAction.name) ); }); + items = _.map(items, function(item) { + if (_.isFunction(item.displayName)) { + item = _.extend({}, item); + item.displayName = item.displayName(self._context); + } + return item; + }); items = items.sort(function(actionA, actionB) { var orderA = actionA.order || 0; var orderB = actionB.order || 0; -- cgit v1.2.3