diff options
Diffstat (limited to 'apps/files/js/app.js')
-rw-r--r-- | apps/files/js/app.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js index 6cdb339b22d..9155fb38cdb 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -11,6 +11,7 @@ * */ +/* global dragOptions, folderDropOptions */ (function() { if (!OCA.Files) { @@ -24,11 +25,16 @@ this.navigation = new OCA.Files.Navigation($('#app-navigation')); // TODO: ideally these should be in a separate class / app (the embedded "all files" app) - this.fileList = OCA.Files.FileList; this.fileActions = OCA.Files.FileActions; this.files = OCA.Files.Files; - this.fileList = new OCA.Files.FileList($('#app-content-files')); + this.fileList = new OCA.Files.FileList( + $('#app-content-files'), { + scrollContainer: $('#app-content'), + dragOptions: dragOptions, + folderDropOptions: folderDropOptions + } + ); this.files.initialize(); this.fileActions.registerDefaultActions(this.fileList); this.fileList.setFileActions(this.fileActions); @@ -58,7 +64,8 @@ OC.Util.History.addOnPopStateHandler(_.bind(this._onPopState, this)); // detect when app changed their current directory - $('#app-content>div').on('changeDirectory', _.bind(this._onDirectoryChanged, this)); + $('#app-content').delegate('>div', 'changeDirectory', _.bind(this._onDirectoryChanged, this)); + $('#app-content').delegate('>div', 'changeViewerMode', _.bind(this._onChangeViewerMode, this)); $('#app-navigation').on('itemChanged', _.bind(this._onNavigationChanged, this)); }, @@ -88,6 +95,16 @@ }, /** + * Event handler for when an app notifies that it needs space + * for viewer mode. + */ + _onChangeViewerMode: function(e) { + var state = !!e.viewerModeEnabled; + $('#app-navigation').toggleClass('hidden', state); + $('.app-files').toggleClass('viewer-mode no-sidebar', state); + }, + + /** * Event handler for when the URL changed */ _onPopState: function(params) { @@ -96,6 +113,9 @@ view: 'files' }, params); var lastId = this.navigation.getActiveItem(); + if (!this.navigation.itemExists(params.view)) { + params.view = 'files'; + } this.navigation.setActiveItem(params.view, {silent: true}); if (lastId !== this.navigation.getActiveItem()) { this.navigation.getActiveContainer().trigger(new $.Event('show')); |