diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/css/detailsView.css | 2 | ||||
-rw-r--r-- | apps/files/css/files.css | 14 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 3 | ||||
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 31 | ||||
-rw-r--r-- | apps/files/js/newfilemenu.js | 2 | ||||
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 19 |
6 files changed, 64 insertions, 7 deletions
diff --git a/apps/files/css/detailsView.css b/apps/files/css/detailsView.css index faa26678562..485c20e6865 100644 --- a/apps/files/css/detailsView.css +++ b/apps/files/css/detailsView.css @@ -40,7 +40,7 @@ height: auto; } -#app-sidebar .image.landscape .thumbnail::before { +#app-sidebar .image .thumbnail .stretcher { content: ''; display: block; padding-bottom: 56.25%; /* sets height of .thumbnail to 9/16 of the width */ diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 24f7a3e5a98..1d4d0774482 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -186,9 +186,15 @@ table th .sort-indicator { filter: alpha(opacity=30); opacity: .3; } -.sort-indicator.hidden { +.sort-indicator.hidden, +.multiselect .sort-indicator, +table.multiselect th:hover .sort-indicator.hidden, +table.multiselect th:focus .sort-indicator.hidden { visibility: hidden; } +.multiselect .sort, .multiselect .sort span { + cursor: default; +} table th:hover .sort-indicator.hidden, table th:focus .sort-indicator.hidden { visibility: visible; @@ -749,6 +755,12 @@ table.dragshadow td.size { margin: 0; } +.newFileMenu.popovermenu a.menuitem.active { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); +} + .newFileMenu.bubble:after { left: 75px; right: auto; diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index b4cc71e2d3b..7a025e772c5 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -628,6 +628,9 @@ * Event handler when clicking on a table header */ _onClickHeader: function(e) { + if (this.$table.hasClass('multiselect')) { + return; + } var $target = $(e.target); var sort; if (!$target.is('a')) { diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index bdec9c08509..b50e92dea8c 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -10,7 +10,7 @@ (function() { var TEMPLATE = - '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"></a></div>' + + '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"><div class="stretcher"/></a></div>' + '<div class="file-details-container">' + '<div class="fileName"><h3 title="{{name}}" class="ellipsis">{{name}}</h3></div>' + ' <div class="file-details ellipsis">' + @@ -141,13 +141,18 @@ }, loadPreview: function(path, mime, etag, $iconDiv, $container, isImage) { - var maxImageHeight = ($container.parent().width() + 50) / (16/9); // 30px for negative margin + var maxImageWidth = $container.parent().width() + 50; // 50px for negative margins + var maxImageHeight = maxImageWidth / (16/9); var smallPreviewSize = 75; var isLandscape = function(img) { return img.width > (img.height * 1.2); }; + var isSmall = function(img) { + return (img.width * 1.1) < (maxImageWidth * window.devicePixelRatio); + }; + var getTargetHeight = function(img) { if(isImage) { var targetHeight = img.height / window.devicePixelRatio; @@ -160,13 +165,23 @@ } }; + var getTargetRatio = function(img){ + var ratio = img.width / img.height; + if (ratio > 16/9) { + return ratio; + } else { + return 16/9; + } + }; + this._fileList.lazyLoadPreview({ path: path, mime: mime, etag: etag, y: isImage ? maxImageHeight : smallPreviewSize, - x: isImage ? 99999 /* only limit on y */ : smallPreviewSize, + x: isImage ? maxImageWidth : smallPreviewSize, a: isImage ? 1 : null, + mode: isImage ? 'cover' : null, callback: function (previewUrl, img) { $iconDiv.previewImg = previewUrl; @@ -177,7 +192,7 @@ $iconDiv.removeClass('icon-loading icon-32'); var targetHeight = getTargetHeight(img); if (this.model.isImage() && targetHeight > smallPreviewSize) { - $container.addClass(isLandscape(img)? 'landscape': 'portrait'); + $container.addClass((isLandscape(img) && !isSmall(img))? 'landscape': 'portrait'); $container.addClass('image'); } @@ -185,7 +200,13 @@ // when we dont have a preview we show the mime icon in the error handler $iconDiv.css({ 'background-image': 'url("' + previewUrl + '")', - height: (isLandscape(img) && targetHeight > smallPreviewSize)? 'auto': targetHeight + height: (targetHeight > smallPreviewSize)? 'auto': targetHeight, + 'max-height': isSmall(img)? targetHeight: null + }); + + var targetRatio = getTargetRatio(img); + $iconDiv.find('.stretcher').css({ + 'padding-bottom': (100 / targetRatio) + '%' }); }.bind(this), error: function () { diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js index 10ddf706d74..0a67aba202b 100644 --- a/apps/files/js/newfilemenu.js +++ b/apps/files/js/newfilemenu.js @@ -84,6 +84,8 @@ OC.hideMenus(); } else { event.preventDefault(); + this.$el.find('.menuitem.active').removeClass('active'); + $target.addClass('active'); this._promptFileName($target); } }, diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index b3d85cf08fa..96018917c85 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -2188,6 +2188,25 @@ describe('OCA.Files.FileList tests', function() { expect(fileList.files.length).toEqual(5); expect(fileList.$fileList.find('tr').length).toEqual(5); }); + it('does not sort when clicking on header whenever multiselect is enabled', function() { + var sortStub = sinon.stub(OCA.Files.FileList.prototype, 'setSort'); + + fileList.setFiles(testFiles); + fileList.findFileEl('One.txt').find('input:checkbox:first').click(); + + fileList.$el.find('.column-size .columntitle').click(); + + expect(sortStub.notCalled).toEqual(true); + + // can sort again after deselecting + fileList.findFileEl('One.txt').find('input:checkbox:first').click(); + + fileList.$el.find('.column-size .columntitle').click(); + + expect(sortStub.calledOnce).toEqual(true); + + sortStub.restore(); + }); }); describe('create file', function() { var deferredCreate; |