Merge pull request #13397 from owncloud/files-greyhighlightondownload

Fix for sticky grey highlight / selection in file list
This commit is contained in:
Lukas Reschke 2015-01-15 20:32:42 +01:00
commit 9b4d5b502f
3 changed files with 35 additions and 1 deletions

View File

@ -258,6 +258,8 @@ table td.filename .thumbnail {
margin-top: 9px;
cursor: pointer;
float: left;
position: absolute;
z-index: 4;
}
table td.filename input.filename {
width: 70%;

View File

@ -323,7 +323,7 @@
*/
_onClickFile: function(event) {
var $tr = $(event.target).closest('tr');
if (event.ctrlKey || event.shiftKey) {
if (this._allowSelection && (event.ctrlKey || event.shiftKey)) {
event.preventDefault();
if (event.shiftKey) {
var $lastTr = $(this._lastChecked);
@ -369,6 +369,8 @@
dir: $tr.attr('data-path') || this.getCurrentDirectory()
});
}
// deselect row
$(event.target).closest('a').blur();
}
}
},

View File

@ -1790,6 +1790,36 @@ describe('OCA.Files.FileList tests', function() {
expect(fileList.$el.find('.select-all').prop('checked')).toEqual(false);
expect(fileList.getSelectedFiles()).toEqual([]);
});
describe('Disabled selection', function() {
beforeEach(function() {
fileList._allowSelection = false;
fileList.setFiles(testFiles);
});
it('Does not render checkboxes', function() {
expect(fileList.$fileList.find('.selectCheckBox').length).toEqual(0);
});
it('Does not select a file with Ctrl or Shift if selection is not allowed', function() {
var $tr = fileList.findFileEl('One.txt');
var $tr2 = fileList.findFileEl('Three.pdf');
var e;
e = new $.Event('click');
e.ctrlKey = true;
$tr.find('td.filename .name').trigger(e);
// click on second entry, does not clear the selection
e = new $.Event('click');
e.ctrlKey = true;
$tr2.find('td.filename .name').trigger(e);
expect(fileList.getSelectedFiles().length).toEqual(0);
// deselect now
e = new $.Event('click');
e.shiftKey = true;
$tr2.find('td.filename .name').trigger(e);
expect(fileList.getSelectedFiles().length).toEqual(0);
});
})
});
describe('File actions', function() {
it('Clicking on a file name will trigger default action', function() {