Close file detail sidebar when selecting/unselecting files
Interacting with the checkboxes, also "Select all" will automatically close the sidebar now.
This commit is contained in:
parent
46b39c3465
commit
d565290d16
|
@ -510,8 +510,9 @@
|
||||||
delete this._selectedFiles[$tr.data('id')];
|
delete this._selectedFiles[$tr.data('id')];
|
||||||
this._selectionSummary.remove(data);
|
this._selectionSummary.remove(data);
|
||||||
}
|
}
|
||||||
if (this._detailsView && this._selectionSummary.getTotal() === 1 && !this._detailsView.$el.hasClass('disappear')) {
|
if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) {
|
||||||
this._updateDetailsView(_.values(this._selectedFiles)[0].name);
|
// hide sidebar
|
||||||
|
this._updateDetailsView(null);
|
||||||
}
|
}
|
||||||
this.$el.find('.select-all').prop('checked', this._selectionSummary.getTotal() === this.files.length);
|
this.$el.find('.select-all').prop('checked', this._selectionSummary.getTotal() === this.files.length);
|
||||||
},
|
},
|
||||||
|
@ -591,8 +592,9 @@
|
||||||
this._selectFileEl($tr, state);
|
this._selectFileEl($tr, state);
|
||||||
this._lastChecked = $tr;
|
this._lastChecked = $tr;
|
||||||
this.updateSelectionSummary();
|
this.updateSelectionSummary();
|
||||||
if (state) {
|
if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) {
|
||||||
this._updateDetailsView($tr.attr('data-file'));
|
// hide sidebar
|
||||||
|
this._updateDetailsView(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -613,6 +615,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateSelectionSummary();
|
this.updateSelectionSummary();
|
||||||
|
if (this._detailsView && !this._detailsView.$el.hasClass('disappear')) {
|
||||||
|
// hide sidebar
|
||||||
|
this._updateDetailsView(null);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,7 +86,7 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
'<table id="filestable">' +
|
'<table id="filestable">' +
|
||||||
'<thead><tr>' +
|
'<thead><tr>' +
|
||||||
'<th id="headerName" class="hidden column-name">' +
|
'<th id="headerName" class="hidden column-name">' +
|
||||||
'<input type="checkbox" id="select_all_files" class="select-all">' +
|
'<input type="checkbox" id="select_all_files" class="select-all checkbox">' +
|
||||||
'<a class="name columntitle" data-sort="name"><span>Name</span><span class="sort-indicator"></span></a>' +
|
'<a class="name columntitle" data-sort="name"><span>Name</span><span class="sort-indicator"></span></a>' +
|
||||||
'<span id="selectedActionsList" class="selectedActions hidden">' +
|
'<span id="selectedActionsList" class="selectedActions hidden">' +
|
||||||
'<a href class="download"><img src="actions/download.svg">Download</a>' +
|
'<a href class="download"><img src="actions/download.svg">Download</a>' +
|
||||||
|
@ -1969,14 +1969,35 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
expect($tr.hasClass('highlighted')).toEqual(true);
|
expect($tr.hasClass('highlighted')).toEqual(true);
|
||||||
expect(fileList._detailsView.getFileInfo().id).toEqual(1);
|
expect(fileList._detailsView.getFileInfo().id).toEqual(1);
|
||||||
});
|
});
|
||||||
it('keeps the last highlighted file when unselecting file using checkbox', function() {
|
it('removes last highlighted file when selecting via checkbox', function() {
|
||||||
var $tr = fileList.findFileEl('One.txt');
|
var $tr = fileList.findFileEl('One.txt');
|
||||||
$tr.find('input:checkbox').click();
|
|
||||||
expect($tr.hasClass('highlighted')).toEqual(true);
|
|
||||||
$tr.find('input:checkbox').click();
|
|
||||||
|
|
||||||
expect($tr.hasClass('highlighted')).toEqual(true);
|
// select
|
||||||
expect(fileList._detailsView.getFileInfo().id).toEqual(1);
|
$tr.find('td.filename>a.name').click();
|
||||||
|
$tr.find('input:checkbox').click();
|
||||||
|
expect($tr.hasClass('highlighted')).toEqual(false);
|
||||||
|
|
||||||
|
// deselect
|
||||||
|
$tr.find('td.filename>a.name').click();
|
||||||
|
$tr.find('input:checkbox').click();
|
||||||
|
expect($tr.hasClass('highlighted')).toEqual(false);
|
||||||
|
|
||||||
|
expect(fileList._detailsView.getFileInfo()).toEqual(null);
|
||||||
|
});
|
||||||
|
it('removes last highlighted file when selecting all files via checkbox', function() {
|
||||||
|
var $tr = fileList.findFileEl('One.txt');
|
||||||
|
|
||||||
|
// select
|
||||||
|
$tr.find('td.filename>a.name').click();
|
||||||
|
fileList.$el.find('.select-all.checkbox').click();
|
||||||
|
expect($tr.hasClass('highlighted')).toEqual(false);
|
||||||
|
|
||||||
|
// deselect
|
||||||
|
$tr.find('td.filename>a.name').click();
|
||||||
|
fileList.$el.find('.select-all.checkbox').click();
|
||||||
|
expect($tr.hasClass('highlighted')).toEqual(false);
|
||||||
|
|
||||||
|
expect(fileList._detailsView.getFileInfo()).toEqual(null);
|
||||||
});
|
});
|
||||||
it('closes sidebar whenever the currently highlighted file was removed from the list', function() {
|
it('closes sidebar whenever the currently highlighted file was removed from the list', function() {
|
||||||
var $tr = fileList.findFileEl('One.txt');
|
var $tr = fileList.findFileEl('One.txt');
|
||||||
|
|
Loading…
Reference in New Issue