aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/app.js8
-rw-r--r--apps/files/js/fileactions.js15
-rw-r--r--apps/files/js/filelist.js19
3 files changed, 29 insertions, 13 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js
index 6ccf5135000..71802948a5c 100644
--- a/apps/files/js/app.js
+++ b/apps/files/js/app.js
@@ -73,6 +73,14 @@
},
/**
+ * Returns the view id of the currently active view
+ * @return view id
+ */
+ getActiveView: function() {
+ return this.navigation.getActiveItem();
+ },
+
+ /**
* Setup events based on URL changes
*/
_setupEvents: function() {
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 8cee037e294..3df62f37518 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -232,7 +232,7 @@
}
if (triggerEvent){
- fileList.$fileList.trigger(jQuery.Event("fileActionsReady"));
+ fileList.$fileList.trigger(jQuery.Event("fileActionsReady", {fileList: fileList}));
}
},
getCurrentFile: function () {
@@ -252,8 +252,6 @@
* Register the actions that are used by default for the files app.
*/
registerDefaultActions: function() {
- // TODO: try to find a way to not make it depend on fileList,
- // maybe get a handler or listener to trigger events on
this.register('all', 'Delete', OC.PERMISSION_DELETE, function () {
return OC.imagePath('core', 'actions/delete');
}, function (filename, context) {
@@ -287,7 +285,8 @@
this.register(downloadScope, 'Download', OC.PERMISSION_READ, function () {
return OC.imagePath('core', 'actions/download');
}, function (filename, context) {
- var url = context.fileList.getDownloadUrl(filename, context.fileList.getCurrentDirectory());
+ var dir = context.dir || context.fileList.getCurrentDirectory();
+ var url = context.fileList.getDownloadUrl(filename, dir);
if (url) {
OC.redirect(url);
}
@@ -309,11 +308,13 @@
// through window.FileActions will be limited to the main file list.
window.FileActions = OCA.Files.legacyFileActions;
window.FileActions.register = function (mime, name, permissions, icon, action, displayName) {
- console.warn('FileActions.register() is deprecated, please use OCA.Files.fileActions.register() instead');
- OCA.Files.FileActions.prototype.register.call(window.FileActions, mime, name, permissions, icon, action, displayName);
+ console.warn('FileActions.register() is deprecated, please use OCA.Files.fileActions.register() instead', arguments);
+ OCA.Files.FileActions.prototype.register.call(
+ window.FileActions, mime, name, permissions, icon, action, displayName
+ );
};
window.FileActions.setDefault = function (mime, name) {
- console.warn('FileActions.setDefault() is deprecated, please use OCA.Files.fileActions.setDefault() instead');
+ console.warn('FileActions.setDefault() is deprecated, please use OCA.Files.fileActions.setDefault() instead', mime, name);
OCA.Files.FileActions.prototype.setDefault.call(window.FileActions, mime, name);
};
})();
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 52d4c8ba3fe..68b22207144 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -508,7 +508,7 @@
this.$el.find('thead').after(this.$fileList);
this.updateEmptyContent();
- this.$fileList.trigger(jQuery.Event("fileActionsReady"));
+ this.$fileList.trigger($.Event('fileActionsReady', {fileList: this}));
this.fileSummary.calculate(filesArray);
@@ -530,7 +530,7 @@
type = fileData.type || 'file',
mtime = parseInt(fileData.mtime, 10) || new Date().getTime(),
mime = fileData.mimetype,
- path = fileData.path || this.getCurrentDirectory(),
+ path = fileData.path,
linkUrl;
options = options || {};
@@ -550,6 +550,13 @@
"data-permissions": fileData.permissions || this.getDirectoryPermissions()
});
+ if (!_.isUndefined(path)) {
+ tr.attr('data-path', path);
+ }
+ else {
+ path = this.getCurrentDirectory();
+ }
+
if (type === 'dir') {
// use default folder icon
icon = icon || OC.imagePath('core', 'filetypes/folder');
@@ -1224,16 +1231,16 @@
// reinsert row
self.files.splice(tr.index(), 1);
tr.remove();
- self.add(fileInfo, {updateSummary: false});
- self.$fileList.trigger($.Event('fileActionsReady'));
+ self.add(fileInfo, {updateSummary: false, silent: true});
+ self.$fileList.trigger($.Event('fileActionsReady', {fileList: self}));
}
});
} else {
// add back the old file info when cancelled
self.files.splice(tr.index(), 1);
tr.remove();
- self.add(oldFileInfo, {updateSummary: false});
- self.$fileList.trigger($.Event('fileActionsReady'));
+ self.add(oldFileInfo, {updateSummary: false, silent: true});
+ self.$fileList.trigger($.Event('fileActionsReady', {fileList: self}));
}
} catch (error) {
input.attr('title', error);