From cee52983448063ceada4b8c5727df23f30e25fef Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 26 Apr 2013 10:57:43 +0200 Subject: [PATCH] update files dialog --- static/js/pandora/filesDialog.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/static/js/pandora/filesDialog.js b/static/js/pandora/filesDialog.js index cd22980b8..57a0649d6 100644 --- a/static/js/pandora/filesDialog.js +++ b/static/js/pandora/filesDialog.js @@ -157,7 +157,7 @@ pandora.ui.filesDialog = function() { $itemLabel = Ox.Label({ textAlign: 'center', title: 'No file selected', - width: itemWidth - 48 + width: getLabelWidth() }) .css({ float: 'left', @@ -309,6 +309,10 @@ pandora.ui.filesDialog = function() { }).open(); } + function getLabelWidth() { + return $content.size(1) - (selected ? 48 : 8); + } + function getPreviewSize() { var ratio = $list.value(selected, 'ratio'), height = ratio < 1 ? 256 : 256 / ratio, @@ -417,6 +421,8 @@ pandora.ui.filesDialog = function() { var file = $list.value(selected), editable = file.user == pandora.user.username || pandora.site.capabilities.canEditFiles[pandora.user.level]; + $embedButton[selected ? 'show' : 'hide'](); + $closeButton[selected ? 'show' : 'hide'](); setLabel(); $item.empty(); if (selected) { @@ -432,14 +438,14 @@ pandora.ui.filesDialog = function() { $itemLabel.options({ title: selected ? selected.split(':').slice(1).join(':') - : 'No file selected' + : 'No file selected', + width: getLabelWidth() }); } function setWidth() { var size; - itemWidth = $content.size(1); - $itemLabel.options({width: itemWidth - 48}); + $itemLabel.options({width: getLabelWidth()}); if (selected) { size = getPreviewSize(), $preview.options({