summaryrefslogtreecommitdiffstats
path: root/apps/files/js/fileactions.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-12-11 15:14:30 +0100
committerVincent Petry <pvince81@owncloud.com>2015-12-11 15:14:30 +0100
commitbaa5a69c55848aede39e14c936f837f77a221496 (patch)
tree77933a5c6063dbe87e687cc81f97d931c6d9707f /apps/files/js/fileactions.js
parent4f860b7e0a5284eee90fdd93d6ec733a1559a1eb (diff)
downloadnextcloud-server-baa5a69c55848aede39e14c936f837f77a221496.tar.gz
nextcloud-server-baa5a69c55848aede39e14c936f837f77a221496.zip
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.
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r--apps/files/js/fileactions.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 871a2149c88..67125f1570f 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -617,7 +617,16 @@
this.registerAction({
name: 'Delete',
- displayName: t('files', 'Delete'),
+ displayName: function(context) {
+ var mountType = context.$file.attr('data-mounttype');
+ var deleteTitle = t('files', 'Delete');
+ if (mountType === 'external-root') {
+ deleteTitle = t('files', 'Disconnect storage');
+ } else if (mountType === 'shared-root') {
+ deleteTitle = t('files', 'Unshare');
+ }
+ return deleteTitle;
+ },
mime: 'all',
order: 1000,
// permission is READ because we show a hint instead if there is no permission
@@ -668,8 +677,9 @@
* @typedef {Object} OCA.Files.FileAction
*
* @property {String} name identifier of the action
- * @property {String} displayName display name of the action, defaults
- * to the name given in name property
+ * @property {(String|OCA.Files.FileActions~displayNameFunction)} displayName
+ * display name string for the action, or function that returns the display name.
+ * Defaults to the name given in name property
* @property {String} mime mime type
* @property {int} permissions permissions
* @property {(Function|String)} icon icon path to the icon or function
@@ -703,6 +713,16 @@
*/
/**
+ * Display name function for actions.
+ * The function returns the display name of the action using
+ * the given context information..
+ *
+ * @callback OCA.Files.FileActions~displayNameFunction
+ * @param {OCA.Files.FileActionContext} context action context
+ * @return {String} display name
+ */
+
+ /**
* Action handler function for file actions
*
* @callback OCA.Files.FileActions~actionHandler