Browse Source

Properly hide sidebar when switching between files app sections

Since there are multiple sidebars, one for each files app section, we
need to hide the correct ones.
tags/v8.2beta1
Vincent Petry 8 years ago
parent
commit
a86602a157
3 changed files with 14 additions and 6 deletions
  1. 4
    0
      apps/files/js/app.js
  2. 2
    2
      apps/files/js/filelist.js
  3. 8
    4
      core/js/apps.js

+ 4
- 0
apps/files/js/app.js View File

@@ -162,6 +162,7 @@
dir: '/'
};
this._changeUrl(params.view, params.dir);
OC.Apps.hideAppSidebar($('.detailsView'));
this.navigation.getActiveContainer().trigger(new $.Event('urlChanged', params));
}
},
@@ -181,6 +182,9 @@
*/
_onChangeViewerMode: function(e) {
var state = !!e.viewerModeEnabled;
if (e.viewerModeEnabled) {
OC.Apps.hideAppSidebar($('.detailsView'));
}
$('#app-navigation').toggleClass('hidden', state);
$('.app-files').toggleClass('viewer-mode no-sidebar', state);
},

+ 2
- 2
apps/files/js/filelist.js View File

@@ -339,7 +339,7 @@
}

if (!fileName) {
OC.Apps.hideAppSidebar();
OC.Apps.hideAppSidebar(this._detailsView.$el);
this._detailsView.setFileInfo(null);
this._currentFileModel = null;
return;
@@ -354,7 +354,7 @@

this._detailsView.setFileInfo(model);
this._detailsView.$el.scrollTop(0);
_.defer(OC.Apps.showAppSidebar);
_.defer(OC.Apps.showAppSidebar, this._detailsView.$el);
},

/**

+ 8
- 4
core/js/apps.js View File

@@ -22,9 +22,11 @@

/**
* Shows the #app-sidebar and add .with-app-sidebar to subsequent siblings
*
* @param {Object} [$el] sidebar element to show, defaults to $('#app-sidebar')
*/
exports.Apps.showAppSidebar = function() {
var $appSidebar = $('#app-sidebar');
exports.Apps.showAppSidebar = function($el) {
var $appSidebar = $el || $('#app-sidebar');
$appSidebar.removeClass('disappear')
$('#app-content').addClass('with-app-sidebar');

@@ -33,9 +35,11 @@
/**
* Shows the #app-sidebar and removes .with-app-sidebar from subsequent
* siblings
*
* @param {Object} [$el] sidebar element to hide, defaults to $('#app-sidebar')
*/
exports.Apps.hideAppSidebar = function() {
var $appSidebar = $('#app-sidebar');
exports.Apps.hideAppSidebar = function($el) {
var $appSidebar = $el || $('#app-sidebar');
$appSidebar.addClass('disappear');
$('#app-content').removeClass('with-app-sidebar');
};

Loading…
Cancel
Save