update files dialog

This commit is contained in:
rolux 2013-04-26 10:57:43 +02:00
parent a7cead82e8
commit cee5298344

View file

@ -157,7 +157,7 @@ pandora.ui.filesDialog = function() {
$itemLabel = Ox.Label({ $itemLabel = Ox.Label({
textAlign: 'center', textAlign: 'center',
title: 'No file selected', title: 'No file selected',
width: itemWidth - 48 width: getLabelWidth()
}) })
.css({ .css({
float: 'left', float: 'left',
@ -309,6 +309,10 @@ pandora.ui.filesDialog = function() {
}).open(); }).open();
} }
function getLabelWidth() {
return $content.size(1) - (selected ? 48 : 8);
}
function getPreviewSize() { function getPreviewSize() {
var ratio = $list.value(selected, 'ratio'), var ratio = $list.value(selected, 'ratio'),
height = ratio < 1 ? 256 : 256 / ratio, height = ratio < 1 ? 256 : 256 / ratio,
@ -417,6 +421,8 @@ pandora.ui.filesDialog = function() {
var file = $list.value(selected), var file = $list.value(selected),
editable = file.user == pandora.user.username editable = file.user == pandora.user.username
|| pandora.site.capabilities.canEditFiles[pandora.user.level]; || pandora.site.capabilities.canEditFiles[pandora.user.level];
$embedButton[selected ? 'show' : 'hide']();
$closeButton[selected ? 'show' : 'hide']();
setLabel(); setLabel();
$item.empty(); $item.empty();
if (selected) { if (selected) {
@ -432,14 +438,14 @@ pandora.ui.filesDialog = function() {
$itemLabel.options({ $itemLabel.options({
title: selected title: selected
? selected.split(':').slice(1).join(':') ? selected.split(':').slice(1).join(':')
: 'No file selected' : 'No file selected',
width: getLabelWidth()
}); });
} }
function setWidth() { function setWidth() {
var size; var size;
itemWidth = $content.size(1); $itemLabel.options({width: getLabelWidth()});
$itemLabel.options({width: itemWidth - 48});
if (selected) { if (selected) {
size = getPreviewSize(), size = getPreviewSize(),
$preview.options({ $preview.options({