diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/css/detailsView.css | 36 | ||||
-rw-r--r-- | apps/files/css/files.css | 1 | ||||
-rw-r--r-- | apps/files/js/detailsview.js | 17 | ||||
-rw-r--r-- | apps/files/js/fileinfomodel.js | 9 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 13 | ||||
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 65 | ||||
-rw-r--r-- | apps/files/l10n/tr.js | 3 | ||||
-rw-r--r-- | apps/files/l10n/tr.json | 3 | ||||
-rw-r--r-- | apps/files/l10n/zh_CN.js | 3 | ||||
-rw-r--r-- | apps/files/l10n/zh_CN.json | 3 | ||||
-rw-r--r-- | apps/files/l10n/zh_TW.js | 4 | ||||
-rw-r--r-- | apps/files/l10n/zh_TW.json | 4 | ||||
-rw-r--r-- | apps/files/tests/js/mainfileinfodetailviewSpec.js | 8 |
13 files changed, 140 insertions, 29 deletions
diff --git a/apps/files/css/detailsView.css b/apps/files/css/detailsView.css index dafd8c24573..8eded7acda1 100644 --- a/apps/files/css/detailsView.css +++ b/apps/files/css/detailsView.css @@ -9,11 +9,41 @@ #app-sidebar .mainFileInfoView { margin-right: 20px; /* accomodate for close icon */ + float:left; + display:block; + width: 100%; +} + +#app-sidebar .file-details-container { + display: inline-block; + float: left; +} + +#app-sidebar .thumbnailContainer.image { + margin-left: -15px; + margin-right: -35px; /* 15 + 20 for the close button */ + margin-top: -15px; +} + +#app-sidebar .image .thumbnail { + width:100%; + display:block; + height: 250px; + background-repeat: no-repeat; + background-position: 50% top; + background-size: 100%; + float: none; + margin: 0; +} + +#app-sidebar .image.portrait .thumbnail { + background-size: contain; } #app-sidebar .thumbnail { width: 75px; height: 75px; + display: inline-block; float: left; margin-right: 10px; background-size: 75px; @@ -31,10 +61,16 @@ padding-bottom: 3px; } +#app-sidebar .fileName h3 { + max-width: 300px; + float:left; +} + #app-sidebar .file-details { margin-top: 3px; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; opacity: .5; + float:left; } #app-sidebar .action-favorite { vertical-align: text-bottom; diff --git a/apps/files/css/files.css b/apps/files/css/files.css index a9c85127c66..375666141ba 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -137,6 +137,7 @@ bottom: 44px; width: inherit !important; background-color: #fff; + border-right: 1px solid #eee; } /* double padding to account for Deleted files entry, issue with Firefox */ .app-files #app-navigation > ul li:nth-last-child(2) { diff --git a/apps/files/js/detailsview.js b/apps/files/js/detailsview.js index a4ebe90cd64..83d7fd4a178 100644 --- a/apps/files/js/detailsview.js +++ b/apps/files/js/detailsview.js @@ -10,24 +10,20 @@ (function() { var TEMPLATE = - '<div>' + ' <div class="detailFileInfoContainer">' + ' </div>' + - ' <div>' + - ' {{#if tabHeaders}}' + - ' <ul class="tabHeaders">' + + ' {{#if tabHeaders}}' + + ' <ul class="tabHeaders">' + ' {{#each tabHeaders}}' + ' <li class="tabHeader" data-tabid="{{tabId}}" data-tabindex="{{tabIndex}}">' + ' <a href="#">{{label}}</a>' + ' </li>' + ' {{/each}}' + - ' </ul>' + - ' {{/if}}' + - ' <div class="tabsContainer">' + - ' </div>' + + ' </ul>' + + ' {{/if}}' + + ' <div class="tabsContainer">' + ' </div>' + - ' <a class="close icon-close" href="#" alt="{{closeLabel}}"></a>' + - '</div>'; + ' <a class="close icon-close" href="#" alt="{{closeLabel}}"></a>'; /** * @class OCA.Files.DetailsView @@ -268,4 +264,3 @@ OCA.Files.DetailsView = DetailsView; })(); - diff --git a/apps/files/js/fileinfomodel.js b/apps/files/js/fileinfomodel.js index 05060854fba..1c850239cdc 100644 --- a/apps/files/js/fileinfomodel.js +++ b/apps/files/js/fileinfomodel.js @@ -53,6 +53,15 @@ }, /** + * Returns whether this file is an image + * + * @return {boolean} true if this is an image, false otherwise + */ + isImage: function() { + return this.get('mimetype').substr(0, 6) === 'image/'; + }, + + /** * Returns the full path to this file * * @return {string} full path diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index ac96d587015..9593ee79e66 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1359,6 +1359,12 @@ if (options.y) { urlSpec.y = options.y; } + if (options.a) { + urlSpec.a = options.a; + } + if (options.mode) { + urlSpec.mode = options.mode; + } if (etag){ // use etag as cache buster @@ -1377,9 +1383,14 @@ img.onload = function(){ // if loading the preview image failed (no preview for the mimetype) then img.width will < 5 if (img.width > 5) { - ready(previewURL); + ready(previewURL, img); + } else if (options.error) { + options.error(); } }; + if (options.error) { + img.onerror = options.error; + } img.src = previewURL; }, diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index 513f833299a..785eed8d712 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -10,14 +10,17 @@ (function() { var TEMPLATE = - '<a href="#" class="thumbnail action-default"></a><div title="{{name}}" class="fileName ellipsis">{{name}}</div>' + - '<div class="file-details ellipsis">' + - ' <a href="#" ' + - ' alt="{{starAltText}}"' + - ' class="action action-favorite favorite">' + - ' <img class="svg" src="{{starIcon}}" />' + - ' </a>' + - ' {{#if hasSize}}<span class="size" title="{{altSize}}">{{size}}</span>, {{/if}}<span class="date" title="{{altDate}}">{{date}}</span>' + + '<div class="thumbnailContainer"><a href="#" class="thumbnail action-default"></a></div>' + + '<div class="file-details-container">' + + '<div class="fileName"><h3 title="{{name}}" class="ellipsis">{{name}}</h3></div>' + + ' <div class="file-details ellipsis">' + + ' <a href="#" ' + + ' alt="{{starAltText}}"' + + ' class="action action-favorite favorite">' + + ' <img class="svg" src="{{starIcon}}" />' + + ' </a>' + + ' {{#if hasSize}}<span class="size" title="{{altSize}}">{{size}}</span>, {{/if}}<span class="date" title="{{altDate}}">{{date}}</span>' + + ' </div>' + '</div>'; /** @@ -103,6 +106,7 @@ if (this.model) { var isFavorite = (this.model.get('tags') || []).indexOf(OC.TAG_FAVORITE) >= 0; this.$el.html(this.template({ + type: this.model.isImage()? 'image': '', nameLabel: t('files', 'Name'), name: this.model.get('displayName') || this.model.get('name'), pathLabel: t('files', 'Path'), @@ -120,16 +124,51 @@ // TODO: we really need OC.Previews var $iconDiv = this.$el.find('.thumbnail'); + $iconDiv.addClass('icon-loading'); + $container = this.$el.find('.thumbnailContainer'); if (!this.model.isDirectory()) { this._fileList.lazyLoadPreview({ path: this.model.getFullPath(), mime: this.model.get('mimetype'), etag: this.model.get('etag'), - x: 75, - y: 75, - callback: function(previewUrl) { - $iconDiv.css('background-image', 'url("' + previewUrl + '")'); - } + y: this.model.isImage() ? 250: 75, + x: this.model.isImage() ? 99999 /* only limit on y */ : 75, + a: this.model.isImage() ? 1 : null, + callback: function(previewUrl, img) { + $iconDiv.previewImg = previewUrl; + if (img) { + $iconDiv.removeClass('icon-loading'); + if(img.height > img.width) { + $container.addClass('portrait'); + } + } + if (this.model.isImage() && img) { + $iconDiv.parent().addClass('image'); + var targetHeight = img.height / window.devicePixelRatio; + if (targetHeight <= 75) { + $container.removeClass('image'); // small enough to fit in normaly + targetHeight = 75; + } + } else { + targetHeight = 75; + } + + // only set background when we have an actual preview + // when we dont have a preview we show the mime icon in the error handler + if (img) { + $iconDiv.css({ + 'background-image': 'url("' + previewUrl + '")', + 'height': targetHeight + }); + } + }.bind(this), + error: function() { + $iconDiv.removeClass('icon-loading'); + this.$el.find('.thumbnailContainer').removeClass('image'); //fall back to regular view + $iconDiv.css({ + 'background-image': 'url("' + $iconDiv.previewImg + '")' + }); + }.bind(this) }); } else { // TODO: special icons / shared / external diff --git a/apps/files/l10n/tr.js b/apps/files/l10n/tr.js index 345b9ffd9fb..2145fb5c9fc 100644 --- a/apps/files/l10n/tr.js +++ b/apps/files/l10n/tr.js @@ -67,6 +67,8 @@ OC.L10N.register( "Storage of {owner} is almost full ({usedSpacePercent}%)" : " {owner} depolama alanı neredeyse dolu ({usedSpacePercent}%)", "Your storage is almost full ({usedSpacePercent}%)" : "Depolama alanınız neredeyse dolu (%{usedSpacePercent})", "_matches '{filter}'_::_match '{filter}'_" : ["'{filter}' ile eşleşiyor","'{filter}' ile eşleşiyor"], + "Path" : "Yol", + "_%n byte_::_%n bytes_" : ["%n bayt","%n bayt"], "Favorited" : "Sık kullanılanlara eklendi", "Favorite" : "Sık kullanılan", "An error occurred while trying to update the tags" : "Etiketler güncellenmeye çalışılırken bir hata oluştu", @@ -90,6 +92,7 @@ OC.L10N.register( "File handling" : "Dosya işlemleri", "Maximum upload size" : "Azami yükleme boyutu", "max. possible: " : "mümkün olan en fazla: ", + "With PHP-FPM this value may take up to 5 minutes to take effect after saving." : "PHP-FPM ile bu değerin kaydedildikten sonra etkili olabilmesi için 5 dakika gerekebilir.", "Save" : "Kaydet", "Can not be edited from here due to insufficient permissions." : "Yetersiz izinler buradan düzenlenemez.", "Settings" : "Ayarlar", diff --git a/apps/files/l10n/tr.json b/apps/files/l10n/tr.json index fc4ca146881..5a1e5f9ec7a 100644 --- a/apps/files/l10n/tr.json +++ b/apps/files/l10n/tr.json @@ -65,6 +65,8 @@ "Storage of {owner} is almost full ({usedSpacePercent}%)" : " {owner} depolama alanı neredeyse dolu ({usedSpacePercent}%)", "Your storage is almost full ({usedSpacePercent}%)" : "Depolama alanınız neredeyse dolu (%{usedSpacePercent})", "_matches '{filter}'_::_match '{filter}'_" : ["'{filter}' ile eşleşiyor","'{filter}' ile eşleşiyor"], + "Path" : "Yol", + "_%n byte_::_%n bytes_" : ["%n bayt","%n bayt"], "Favorited" : "Sık kullanılanlara eklendi", "Favorite" : "Sık kullanılan", "An error occurred while trying to update the tags" : "Etiketler güncellenmeye çalışılırken bir hata oluştu", @@ -88,6 +90,7 @@ "File handling" : "Dosya işlemleri", "Maximum upload size" : "Azami yükleme boyutu", "max. possible: " : "mümkün olan en fazla: ", + "With PHP-FPM this value may take up to 5 minutes to take effect after saving." : "PHP-FPM ile bu değerin kaydedildikten sonra etkili olabilmesi için 5 dakika gerekebilir.", "Save" : "Kaydet", "Can not be edited from here due to insufficient permissions." : "Yetersiz izinler buradan düzenlenemez.", "Settings" : "Ayarlar", diff --git a/apps/files/l10n/zh_CN.js b/apps/files/l10n/zh_CN.js index 92945f43ba5..9633e2961a9 100644 --- a/apps/files/l10n/zh_CN.js +++ b/apps/files/l10n/zh_CN.js @@ -67,6 +67,8 @@ OC.L10N.register( "Storage of {owner} is almost full ({usedSpacePercent}%)" : "{owner} 的存储空间即将用完 ({usedSpacePercent}%)", "Your storage is almost full ({usedSpacePercent}%)" : "您的存储空间即将用完 ({usedSpacePercent}%)", "_matches '{filter}'_::_match '{filter}'_" : ["匹配“{filter}”"], + "Path" : "路径", + "_%n byte_::_%n bytes_" : ["%n 字节"], "Favorited" : "已收藏", "Favorite" : "收藏", "An error occurred while trying to update the tags" : "更新标签时出错", @@ -90,6 +92,7 @@ OC.L10N.register( "File handling" : "文件处理", "Maximum upload size" : "最大上传大小", "max. possible: " : "最大允许: ", + "With PHP-FPM this value may take up to 5 minutes to take effect after saving." : "对于 PHP-FPM 这个值保存后可能需要长达5分钟才会生效。", "Save" : "保存", "Can not be edited from here due to insufficient permissions." : "由于权限不足无法在此编辑。", "Settings" : "设置", diff --git a/apps/files/l10n/zh_CN.json b/apps/files/l10n/zh_CN.json index 5bd652a3444..b803908729f 100644 --- a/apps/files/l10n/zh_CN.json +++ b/apps/files/l10n/zh_CN.json @@ -65,6 +65,8 @@ "Storage of {owner} is almost full ({usedSpacePercent}%)" : "{owner} 的存储空间即将用完 ({usedSpacePercent}%)", "Your storage is almost full ({usedSpacePercent}%)" : "您的存储空间即将用完 ({usedSpacePercent}%)", "_matches '{filter}'_::_match '{filter}'_" : ["匹配“{filter}”"], + "Path" : "路径", + "_%n byte_::_%n bytes_" : ["%n 字节"], "Favorited" : "已收藏", "Favorite" : "收藏", "An error occurred while trying to update the tags" : "更新标签时出错", @@ -88,6 +90,7 @@ "File handling" : "文件处理", "Maximum upload size" : "最大上传大小", "max. possible: " : "最大允许: ", + "With PHP-FPM this value may take up to 5 minutes to take effect after saving." : "对于 PHP-FPM 这个值保存后可能需要长达5分钟才会生效。", "Save" : "保存", "Can not be edited from here due to insufficient permissions." : "由于权限不足无法在此编辑。", "Settings" : "设置", diff --git a/apps/files/l10n/zh_TW.js b/apps/files/l10n/zh_TW.js index 049b63814a6..eeefcd95884 100644 --- a/apps/files/l10n/zh_TW.js +++ b/apps/files/l10n/zh_TW.js @@ -65,7 +65,11 @@ OC.L10N.register( "Your storage is full, files can not be updated or synced anymore!" : "您的儲存空間已滿,沒有辦法再更新或是同步檔案!", "Storage of {owner} is almost full ({usedSpacePercent}%)" : "{owner} 的儲存空間快要滿了 ({usedSpacePercent}%)", "Your storage is almost full ({usedSpacePercent}%)" : "您的儲存空間快要滿了 ({usedSpacePercent}%)", + "Path" : "路徑", + "_%n byte_::_%n bytes_" : ["%n 位元組"], + "Favorited" : "已加入最愛", "Favorite" : "我的最愛", + "An error occurred while trying to update the tags" : "更新標籤時發生錯誤", "A new file or folder has been <strong>created</strong>" : "新的檔案或目錄已被 <strong>建立</strong>", "A file or folder has been <strong>changed</strong>" : "檔案或目錄已被 <strong>變更</strong>", "A file or folder has been <strong>deleted</strong>" : "檔案或目錄已被 <strong>刪除</strong>", diff --git a/apps/files/l10n/zh_TW.json b/apps/files/l10n/zh_TW.json index 7b047c3c012..84af9fae39e 100644 --- a/apps/files/l10n/zh_TW.json +++ b/apps/files/l10n/zh_TW.json @@ -63,7 +63,11 @@ "Your storage is full, files can not be updated or synced anymore!" : "您的儲存空間已滿,沒有辦法再更新或是同步檔案!", "Storage of {owner} is almost full ({usedSpacePercent}%)" : "{owner} 的儲存空間快要滿了 ({usedSpacePercent}%)", "Your storage is almost full ({usedSpacePercent}%)" : "您的儲存空間快要滿了 ({usedSpacePercent}%)", + "Path" : "路徑", + "_%n byte_::_%n bytes_" : ["%n 位元組"], + "Favorited" : "已加入最愛", "Favorite" : "我的最愛", + "An error occurred while trying to update the tags" : "更新標籤時發生錯誤", "A new file or folder has been <strong>created</strong>" : "新的檔案或目錄已被 <strong>建立</strong>", "A file or folder has been <strong>changed</strong>" : "檔案或目錄已被 <strong>變更</strong>", "A file or folder has been <strong>deleted</strong>" : "檔案或目錄已被 <strong>刪除</strong>", diff --git a/apps/files/tests/js/mainfileinfodetailviewSpec.js b/apps/files/tests/js/mainfileinfodetailviewSpec.js index 582824585b5..3d78312c86e 100644 --- a/apps/files/tests/js/mainfileinfodetailviewSpec.js +++ b/apps/files/tests/js/mainfileinfodetailviewSpec.js @@ -55,8 +55,8 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() { var clock = sinon.useFakeTimers(Date.UTC(2015, 6, 17, 1, 2, 0, 3)); var dateExpected = OC.Util.formatDate(Date(Date.UTC(2015, 6, 17, 1, 2, 0, 0))); view.setFileInfo(testFileInfo); - expect(view.$el.find('.fileName').text()).toEqual('One.txt'); - expect(view.$el.find('.fileName').attr('title')).toEqual('One.txt'); + expect(view.$el.find('.fileName h3').text()).toEqual('One.txt'); + expect(view.$el.find('.fileName h3').attr('title')).toEqual('One.txt'); expect(view.$el.find('.size').text()).toEqual('117.7 MB'); expect(view.$el.find('.size').attr('title')).toEqual('123456789 bytes'); expect(view.$el.find('.date').text()).toEqual('a few seconds ago'); @@ -110,8 +110,8 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() { testFileInfo.set('displayName', 'hello.txt'); view.setFileInfo(testFileInfo); - expect(view.$el.find('.fileName').text()).toEqual('hello.txt'); - expect(view.$el.find('.fileName').attr('title')).toEqual('hello.txt'); + expect(view.$el.find('.fileName h3').text()).toEqual('hello.txt'); + expect(view.$el.find('.fileName h3').attr('title')).toEqual('hello.txt'); }); it('rerenders when changes are made on the model', function() { view.setFileInfo(testFileInfo); |