use correct cover in preview

This commit is contained in:
rlx 2016-01-12 14:07:41 +05:30
parent b71b35a418
commit 16c0514809

View file

@ -7,8 +7,10 @@ oml.ui.previewDialog = function() {
$image, $image,
$list = oml.$ui.list, $list = oml.$ui.list,
item = Ox.last($list.options('selected')), item = Ox.last($list.options('selected')),
coverRatio = $list.value(item, 'coverRatio') || oml.config.iconRatio, imageRatio = $list.value(
size = getSize(coverRatio), item, ui.icons == 'cover' ? 'coverRatio' : 'previewRatio'
) || oml.config.iconRatio,
size = getSize(imageRatio),
that = Ox.Dialog({ that = Ox.Dialog({
closeButton: true, closeButton: true,
@ -55,11 +57,13 @@ oml.ui.previewDialog = function() {
that.updateElement = function() { that.updateElement = function() {
oml.api.get({ oml.api.get({
id: Ox.last($list.options('selected')), id: Ox.last($list.options('selected')),
keys: ['coverRatio', 'id', 'modified', 'title'] keys: ['coverRatio', 'id', 'modified', 'previewRatio', 'title']
}, function(result) { }, function(result) {
var item = result.data, var item = result.data,
coverRatio = item.coverRatio || oml.config.iconRatio, imageRatio = item[
size = getSize(coverRatio), ui.icons == 'cover' ? 'coverRatio' : 'previewRatio'
] || oml.config.iconRatio,
size = getSize(imageRatio),
title = Ox.encodeHTMLEntities(item.title); title = Ox.encodeHTMLEntities(item.title);
$image = $('<img>') $image = $('<img>')
.attr({ .attr({
@ -76,7 +80,7 @@ oml.ui.previewDialog = function() {
}); });
}) })
.attr({ .attr({
src: '/' + item.id + '/cover1024.jpg?' + item.modified src: '/' + item.id + '/' + ui.icons + '1024.jpg?' + item.modified
}); });
that.options({ that.options({
content: $image, content: $image,