From d897cb13bdf9e8d8fa12baed5b7849050bb8b104 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 18 Aug 2011 11:32:47 +0000 Subject: [PATCH] small bugfixes --- static/js/pandora/ui/contentPanel.js | 2 +- static/js/pandora/ui/group.js | 17 +++++++----- static/js/pandora/ui/item.js | 2 +- static/js/pandora/ui/list.js | 39 +++++++++++++++++++++++++--- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/static/js/pandora/ui/contentPanel.js b/static/js/pandora/ui/contentPanel.js index 90b4f5b0..82ba6a33 100644 --- a/static/js/pandora/ui/contentPanel.js +++ b/static/js/pandora/ui/contentPanel.js @@ -1,7 +1,7 @@ // vim: et:ts=4:sw=4:sts=4:ft=javascript pandora.ui.contentPanel = function() { var that = Ox.SplitPanel({ - elements: pandora.user.ui.item == '' ? [ + elements: !pandora.user.ui.item ? [ { collapsed: !pandora.user.ui.showGroups, collapsible: true, diff --git a/static/js/pandora/ui/group.js b/static/js/pandora/ui/group.js index c9c6a521..0e96d53a 100644 --- a/static/js/pandora/ui/group.js +++ b/static/js/pandora/ui/group.js @@ -34,13 +34,16 @@ pandora.ui.group = function(id, query) { columnsVisible: true, id: 'group_' + id, items: function(data, callback) { - //Ox.print('sending request', data) - delete data.keys; - //alert(id + " pandora.Query.toObject " + JSON.stringify(pandora.Query.toObject(id)) + ' ' + JSON.stringify(data)) - return pandora.api.find($.extend(data, { - group: id, - query: pandora.Query.toObject(id) - }), callback); + //if (pandora.user.ui.showGroups) { + delete data.keys; + //alert(id + " pandora.Query.toObject " + JSON.stringify(pandora.Query.toObject(id)) + ' ' + JSON.stringify(data)) + return pandora.api.find($.extend(data, { + group: id, + query: pandora.Query.toObject(id) + }), callback); + //} else { + // callback({data: {items: data.keys ? [] : 0}}); + //} }, scrollbarVisible: true, selected: query ? $.map(query.conditions, function(v) { diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index 86a005b6..932b2bea 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -293,7 +293,7 @@ pandora.ui.item = function() { streams = {}; video.height = video.resolutions[0]; video.width = parseInt(video.height * video.aspectRatio / 2) * 2; - video.resolutions.forEach(function(profile) { + video.resolutions.forEach(function(resolution) { streams[resolution] = video.baseUrl + '/' + resolution + 'p.' + format; }); $.each(pandora.site.layers, function(i, layer) { diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 210badd9..e963157b 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -112,7 +112,38 @@ pandora.ui.list = function() { // fixme: remove view argument unique: 'id' }); } else if (view == 'info') { - that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.'); + that = Ox.IconList({ + borderRadius: pandora.user.ui.icons == 'posters' ? 0 : 16, + defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, + id: 'list', + item: function(data, sort, size) { + var icons = pandora.user.ui.icons, + ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1; + size = size || 128; + return { + height: ratio <= 1 ? size : size / ratio, + id: data.id, + info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key], + title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''), + url: icons == 'posters' + ? '/' + data.id + '/poster' + size + '.jpg' + : '/' + data.id + '/icon' + size + '.jpg', + width: ratio >= 1 ? size : size * ratio + }; + }, + items: function(data, callback) { + //Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject()) + pandora.api.find($.extend(data, { + query: pandora.Query.toObject() + }), callback); + }, + keys: ['director', 'id', 'poster', 'title', 'year'], + orientation: 'vertical', + selected: pandora.user.ui.lists[pandora.user.ui.list].selected, + size: 128, + sort: pandora.user.ui.lists[pandora.user.ui.list].sort, + unique: 'id' + }); } else if (view == 'clips') { that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.'); } else if (view == 'timelines') { @@ -218,7 +249,7 @@ pandora.ui.list = function() { // fixme: remove view argument size = size || 128; var width = data.aspectRatio < fixedRatio ? size : size * data.aspectRatio / fixedRatio, height = width / data.aspectRatio, - url = '/' + data.item + '/' + width + '/' + data['in'] + '.jpg'; + url = '/' + data.item + '/' + height + 'p' + data['in'] + '.jpg'; return { height: height, id: data.id, @@ -300,12 +331,12 @@ pandora.ui.list = function() { // fixme: remove view argument ['list', 'icons'].indexOf(view) > -1 && that.bind({ dragstart: function(e) { - pandora.$ui.folderList.forEach(function($list, i) { + Ox.forEach(pandora.$ui.folderList, function($list, i) { $list.addClass('OxDrop'); }); }, dragend: function(e) { - pandora.$ui.folderList.forEach(function($list, i) { + Ox.forEach(pandora.$ui.folderList, function($list, i) { $list.removeClass('OxDrop'); }); }