diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-11-18 11:37:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-18 11:37:29 +0100 |
commit | 0e699c4d147729b8ffa8d9c969f431845a2282cf (patch) | |
tree | 17316e72898ba12c45aa3b6adff33300d6f9a497 /apps/files_versions | |
parent | c02b0199b0d9021c132bee7a22858133e12c729b (diff) | |
parent | 96debafd08fb56a0e7930596ce54f401feb442b3 (diff) | |
download | nextcloud-server-0e699c4d147729b8ffa8d9c969f431845a2282cf.tar.gz nextcloud-server-0e699c4d147729b8ffa8d9c969f431845a2282cf.zip |
Merge pull request #2116 from nextcloud/downstream-26511
Display changes in file versions tab view and detailsView
Diffstat (limited to 'apps/files_versions')
-rw-r--r-- | apps/files_versions/css/versions.css | 29 | ||||
-rw-r--r-- | apps/files_versions/js/versionstabview.js | 17 | ||||
-rw-r--r-- | apps/files_versions/tests/js/versionstabviewSpec.js | 3 |
3 files changed, 42 insertions, 7 deletions
diff --git a/apps/files_versions/css/versions.css b/apps/files_versions/css/versions.css index b159de82ea3..cd63a90ab51 100644 --- a/apps/files_versions/css/versions.css +++ b/apps/files_versions/css/versions.css @@ -1,6 +1,7 @@ .versionsTabView .clear-float { clear: both; } + .versionsTabView li { width: 100%; cursor: default; @@ -12,25 +13,30 @@ border-bottom: none; } -.versionsTabView li > * { +.versionsTabView a, +.versionsTabView div > span { vertical-align: middle; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50); opacity: .5; } -.versionsTabView li > a, -.versionsTabView li > span { +.versionsTabView li a{ padding: 15px 10px 11px; } -.versionsTabView li > *:hover, -.versionsTabView li > *:focus { +.versionsTabView a:hover, +.versionsTabView a:focus { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter: alpha(opacity=100); opacity: 1; } +.versionsTabView .preview-container { + display: inline-block; + vertical-align: top; +} + .versionsTabView img { cursor: pointer; padding-right: 4px; @@ -38,7 +44,10 @@ .versionsTabView img.preview { cursor: default; - opacity: 1; +} + +.versionsTabView .version-container { + display: inline-block; } .versionsTabView .versiondate { @@ -46,6 +55,14 @@ vertical-align: super; } +.versionsTabView .version-details { + text-align: left; +} + +.versionsTabView .version-details > span { + padding: 0 10px; +} + .versionsTabView .revertVersion { cursor: pointer; float: right; diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js index 2e334edacb5..35abde6d34a 100644 --- a/apps/files_versions/js/versionstabview.js +++ b/apps/files_versions/js/versionstabview.js @@ -13,13 +13,26 @@ (function() { var TEMPLATE_ITEM = '<li data-revision="{{timestamp}}">' + + '<div>' + + '<div class="preview-container">' + '<img class="preview" src="{{previewUrl}}"/>' + + '</div>' + + '<div class="version-container">' + + '<div>' + '<a href="{{downloadUrl}}" class="downloadVersion"><img src="{{downloadIconUrl}}" />' + '<span class="versiondate has-tooltip live-relative-timestamp" data-timestamp="{{millisecondsTimestamp}}" title="{{formattedTimestamp}}">{{relativeTimestamp}}</span>' + '</a>' + + '</div>' + + '{{#hasDetails}}' + + '<div class="version-details">' + + '<span class="size has-tooltip" title="{{altSize}}">{{humanReadableSize}}</span>' + + '</div>' + + '{{/hasDetails}}' + + '</div>' + '{{#canRevert}}' + '<a href="#" class="revertVersion" title="{{revertLabel}}"><img src="{{revertIconUrl}}" /></a>' + '{{/canRevert}}' + + '</div>' + '</li>'; var TEMPLATE = @@ -182,10 +195,14 @@ _formatItem: function(version) { var timestamp = version.get('timestamp') * 1000; + var size = version.has('size') ? version.get('size') : 0; return _.extend({ millisecondsTimestamp: timestamp, formattedTimestamp: OC.Util.formatDate(timestamp), relativeTimestamp: OC.Util.relativeModifiedDate(timestamp), + humanReadableSize: OC.Util.humanFileSize(size, true), + altSize: n('files', '%n byte', '%n bytes', size), + hasDetails: version.has('size'), downloadUrl: version.getDownloadUrl(), downloadIconUrl: OC.imagePath('core', 'actions/download'), revertIconUrl: OC.imagePath('core', 'actions/history'), diff --git a/apps/files_versions/tests/js/versionstabviewSpec.js b/apps/files_versions/tests/js/versionstabviewSpec.js index 94285c93aba..9b788db1970 100644 --- a/apps/files_versions/tests/js/versionstabviewSpec.js +++ b/apps/files_versions/tests/js/versionstabviewSpec.js @@ -78,12 +78,14 @@ describe('OCA.Versions.VersionsTabView', function() { var $item = $versions.eq(0); expect($item.find('.downloadVersion').attr('href')).toEqual(version1.getDownloadUrl()); expect($item.find('.versiondate').text()).toEqual('seconds ago'); + expect($item.find('.size').text()).toEqual('< 1 KB'); expect($item.find('.revertVersion').length).toEqual(1); expect($item.find('.preview').attr('src')).toEqual(version1.getPreviewUrl()); $item = $versions.eq(1); expect($item.find('.downloadVersion').attr('href')).toEqual(version2.getDownloadUrl()); expect($item.find('.versiondate').text()).toEqual('2 days ago'); + expect($item.find('.size').text()).toEqual('< 1 KB'); expect($item.find('.revertVersion').length).toEqual(1); expect($item.find('.preview').attr('src')).toEqual(version2.getPreviewUrl()); }); @@ -231,4 +233,3 @@ describe('OCA.Versions.VersionsTabView', function() { }); }); }); - |