From 6fd084243b65a556d4775209ba3916145ef5912a Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 12 May 2014 19:54:20 +0200 Subject: Fixed many issues, clean up - fixed upload and storage statistics - fixed infinite scroll to use the correct contain for scroll detection - fixed unit test that sometimes fail for rename case - controls are now sticky again - fixed selection overlay to be aligned with the table - fixed "select all" checkbox that had id conflicts - fixed public page - fixed global actions permissions detection - fix when URL contains an invalid view id - viewer mode now hides the sidebar (ex: text editor) - added unit tests for trashbin - clean up storage info in template (most is retrieved via ajax call now) --- apps/files/js/app.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'apps/files/js/app.js') 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)); }, @@ -87,6 +94,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 */ @@ -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')); -- cgit v1.2.3