aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/breadcrumb.js2
-rw-r--r--apps/files/js/fileactions.js26
-rw-r--r--apps/files/js/filelist.js19
3 files changed, 35 insertions, 12 deletions
diff --git a/apps/files/js/breadcrumb.js b/apps/files/js/breadcrumb.js
index 35aeb8d357d..20b15e3cb93 100644
--- a/apps/files/js/breadcrumb.js
+++ b/apps/files/js/breadcrumb.js
@@ -331,7 +331,7 @@
// Used for testing since this.$el.parent fails
if (!this.availableWidth) {
- this.usedWidth = this.$el.parent().width() - (this.$el.parent().find('.button').length + 1) * 44;
+ this.usedWidth = this.$el.parent().width() - this.$el.parent().find('.actions.creatable').width();
} else {
this.usedWidth = this.availableWidth;
}
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 6c031ab06d5..2fb7dfba29f 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -47,14 +47,6 @@
*/
$el: null,
- /**
- * List of handlers to be notified whenever a register() or
- * setDefault() was called.
- *
- * @member {Function[]}
- */
- _updateListeners: {},
-
_fileActionTriggerTemplate: null,
/**
@@ -142,7 +134,22 @@
var mime = action.mime;
var name = action.name;
var actionSpec = {
- action: action.actionHandler,
+ action: function(fileName, context) {
+ // Actions registered in one FileAction may be executed on a
+ // different one (for example, due to the "merge" function),
+ // so the listeners have to be updated on the FileActions
+ // from the context instead of on the one in which it was
+ // originally registered.
+ if (context && context.fileActions) {
+ context.fileActions._notifyUpdateListeners('beforeTriggerAction', {action: actionSpec, fileName: fileName, context: context});
+ }
+
+ action.actionHandler(fileName, context);
+
+ if (context && context.fileActions) {
+ context.fileActions._notifyUpdateListeners('afterTriggerAction', {action: actionSpec, fileName: fileName, context: context});
+ }
+ },
name: name,
displayName: action.displayName,
mime: mime,
@@ -174,7 +181,6 @@
this.defaults = {};
this.icons = {};
this.currentFile = null;
- this._updateListeners = [];
},
/**
* Sets the default action for a given mime type.
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index fa9819b78b5..7735e9357b1 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -676,8 +676,25 @@
$(event.target).closest('a').blur();
}
} else {
- this._updateDetailsView($tr.attr('data-file'));
+ // Even if there is no Details action the default event
+ // handler is prevented for consistency (although there
+ // should always be a Details action); otherwise the link
+ // would be downloaded by the browser when the user expected
+ // the details to be shown.
event.preventDefault();
+ var filename = $tr.attr('data-file');
+ var mime = this.fileActions.getCurrentMimeType();
+ var type = this.fileActions.getCurrentType();
+ var permissions = this.fileActions.getCurrentPermissions();
+ var action = this.fileActions.get(mime, type, permissions)['Details'];
+ if (action) {
+ action(filename, {
+ $file: $tr,
+ fileList: this,
+ fileActions: this.fileActions,
+ dir: $tr.attr('data-path') || this.getCurrentDirectory()
+ });
+ }
}
}
},