From af1f7a28c98c6d6ad5f8e361efa10d480efd6ee8 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 7 Jun 2011 04:09:31 +0000 Subject: [PATCH 1/2] improving info view --- static/html/itemInfo.html | 52 ++++++++++++++++++++---------------- static/js/pandora/ui/item.js | 7 +++-- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/static/html/itemInfo.html b/static/html/itemInfo.html index ef34d6b5..35f86e30 100644 --- a/static/html/itemInfo.html +++ b/static/html/itemInfo.html @@ -1,79 +1,85 @@
-
- +
+
+ +
+
+ +
+
-
-
+
+
${title}
-
+
${director}
- Country: ${country} + Country: ${country} - Year: ${year} + Year: ${year} - Language: ${language} + Language: ${language} - Runtime: ${runtime} + Runtime: ${runtime}
- Alternative Title(s): {alternative_titles} + Alternative Title(s): ${alternative_titles}
- Writer: ${writer} + Writer: ${writer}
- Producer: ${producer} + Producer: ${producer}
- Cast: ${cast} + Cast: ${cast}
- Genre: ${genre} + Genre: ${genre}
- Keywords: ${keyword} + Keywords: ${keyword}
- Summary: FIXME + Summary: FIXME
FIXTRIVA
- Release Date: ${release_date} + Release Date: ${release_date}
- Budget: ${budget} + Budget: ${budget} - Gross: ${gross} + Gross: ${gross} - Profit: ${profit} + Profit: ${profit}
- Rating: ${rating} + Rating: ${rating} - Votes: ${votes} + Votes: ${votes}
FIXME: movie connections
- Reviews: ${reviewsHtml} + Reviews: ${reviewsHtml}
diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index 7851790f..24cf831a 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -105,9 +105,12 @@ pandora.ui.item = function() { } else { $.get('/static/html/itemInfo.html', {}, function(template) { //Ox.print(template); + var posterRatio = result.data.poster.width / result.data.poster.height; + result.data.posterWidth = posterRatio > 1 ? 256 : Math.round(256 * posterRatio); + result.data.posterHeight = posterRatio < 1 ? 256 : Math.round(256 / posterRatio); + result.data.posterLeft = Math.floor((256 - result.data.posterWidth) / 2); pandora.$ui.contentPanel.replaceElement(1, - pandora.$ui.item = Ox.Element() - .append($.tmpl(template, result.data)) + pandora.$ui.item = Ox.Element().append($.tmpl(template, result.data)) ); }); } From 881eb58e82e0799f464ec2087e82deb87e86f81b Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 7 Jun 2011 05:28:29 +0000 Subject: [PATCH 2/2] some fixes for preview dialog --- static/js/pandora/ui/list.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 442bfdbb..d7c6b5bb 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -335,10 +335,10 @@ pandora.ui.list = function(view) { // fixme: remove view argument var documentHeight = pandora.$ui.document.height(), item = result.data.items[0], title = item.title + (item.director ? ' (' + item.director + ')' : ''), - dialogHeight = documentHeight - 100, + dialogHeight = documentHeight - 48, dialogWidth; pandora.site.previewRatio = item.poster.width / item.poster.height, - dialogWidth = parseInt((dialogHeight - 48) * pandora.site.previewRatio); + dialogWidth = Math.round((dialogHeight - 48) * pandora.site.previewRatio); if ('previewDialog' in pandora.$ui) { pandora.$ui.previewDialog.options({ title: title @@ -355,7 +355,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument pandora.$ui.previewImage .css({ width: dialogWidth + 'px', - height: (dialogHeight - 48 - 2) + 'px', // fixme: why -2 ? + height: (dialogHeight - 48) + 'px', // fixme: why -2 ? opacity: 0 }) .animate({ @@ -373,7 +373,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument .css({ position: 'absolute', width: dialogWidth + 'px', - height: (dialogHeight - 48 - 2) + 'px', // fixme: why -2 ? + height: (dialogHeight - 48) + 'px', // fixme: why -2 ? left: 0, top: 0, right: 0, @@ -393,10 +393,11 @@ pandora.ui.list = function(view) { // fixme: remove view argument }) ], content: pandora.$ui.previewImage, + focus: false, height: dialogHeight, id: 'previewDialog', - minHeight: pandora.site.previewRatio >= 1 ? 128 / pandora.site.previewRatio + 48 : 176, - minWidth: pandora.site.previewRatio >= 1 ? 128 : 176 * pandora.site.previewRatio, + minHeight: pandora.site.previewRatio >= 1 ? Math.round(128 / pandora.site.previewRatio) + 48 : 176, + minWidth: pandora.site.previewRatio >= 1 ? 128 : Math.round(176 * pandora.site.previewRatio), padding: 0, title: title, width: dialogWidth @@ -406,10 +407,10 @@ pandora.ui.list = function(view) { // fixme: remove view argument height, width; if (dialogRatio < pandora.site.previewRatio) { width = data.width; - height = width / pandora.site.previewRatio; + height = Math.round(width / pandora.site.previewRatio); } else { - height = (data.height - 48 - 2); - width = height * pandora.site.previewRatio; + height = (data.height - 48); + width = Math.round(height * pandora.site.previewRatio); } pandora.$ui.previewImage.css({ width: width + 'px',