From d565290d16ac708a3ae561d564484acc0fac0610 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 15 Feb 2016 14:58:44 +0100 Subject: [PATCH] Close file detail sidebar when selecting/unselecting files Interacting with the checkboxes, also "Select all" will automatically close the sidebar now. --- apps/files/js/filelist.js | 14 ++++++++---- apps/files/tests/js/filelistSpec.js | 35 +++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 1a6f38d3d7..dd03b0c895 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -510,8 +510,9 @@ delete this._selectedFiles[$tr.data('id')]; this._selectionSummary.remove(data); } - if (this._detailsView && this._selectionSummary.getTotal() === 1 && !this._detailsView.$el.hasClass('disappear')) { - this._updateDetailsView(_.values(this._selectedFiles)[0].name); + if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) { + // hide sidebar + this._updateDetailsView(null); } this.$el.find('.select-all').prop('checked', this._selectionSummary.getTotal() === this.files.length); }, @@ -591,8 +592,9 @@ this._selectFileEl($tr, state); this._lastChecked = $tr; this.updateSelectionSummary(); - if (state) { - this._updateDetailsView($tr.attr('data-file')); + if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) { + // hide sidebar + this._updateDetailsView(null); } }, @@ -613,6 +615,10 @@ } } this.updateSelectionSummary(); + if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) { + // hide sidebar + this._updateDetailsView(null); + } }, /** diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 0091a9ee6e..ed56011866 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -86,7 +86,7 @@ describe('OCA.Files.FileList tests', function() { '' + '' + '