aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/app.js')
-rw-r--r--apps/files/js/app.js35
1 files changed, 29 insertions, 6 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js
index 9155fb38cdb..71802948a5c 100644
--- a/apps/files/js/app.js
+++ b/apps/files/js/app.js
@@ -24,20 +24,27 @@
initialize: function() {
this.navigation = new OCA.Files.Navigation($('#app-navigation'));
- // TODO: ideally these should be in a separate class / app (the embedded "all files" app)
- this.fileActions = OCA.Files.FileActions;
+ var fileActions = new OCA.Files.FileActions();
+ // default actions
+ fileActions.registerDefaultActions();
+ // legacy actions
+ fileActions.merge(window.FileActions);
+ // regular actions
+ fileActions.merge(OCA.Files.fileActions);
+
this.files = OCA.Files.Files;
+ // TODO: ideally these should be in a separate class / app (the embedded "all files" app)
this.fileList = new OCA.Files.FileList(
$('#app-content-files'), {
scrollContainer: $('#app-content'),
dragOptions: dragOptions,
- folderDropOptions: folderDropOptions
+ folderDropOptions: folderDropOptions,
+ fileActions: fileActions,
+ allowLegacyActions: true
}
);
this.files.initialize();
- this.fileActions.registerDefaultActions(this.fileList);
- this.fileList.setFileActions(this.fileActions);
// for backward compatibility, the global FileList will
// refer to the one of the "files" view
@@ -58,6 +65,22 @@
},
/**
+ * Sets the currently active view
+ * @param viewId view id
+ */
+ setActiveView: function(viewId, options) {
+ this.navigation.setActiveItem(viewId, options);
+ },
+
+ /**
+ * 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() {
@@ -138,7 +161,7 @@
})();
$(document).ready(function() {
- // wait for other apps/extensions to register their event handlers
+ // wait for other apps/extensions to register their event handlers and file actions
// in the "ready" clause
_.defer(function() {
OCA.Files.App.initialize();