From fbf8424f4029e35727b2a025fac1160d68b1ae67 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 5 Oct 2011 19:35:16 +0200 Subject: [PATCH] use list description --- pandora/app/views.py | 2 +- static/js/pandora/ui/info.js | 39 ++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/pandora/app/views.py b/pandora/app/views.py index deee6c5e..92bbca51 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -80,7 +80,7 @@ def editPage(request): page.save() response = json_response({'name': page.name, 'page': page.body}) return render_to_json_response(response) -actions.register(getPage) +actions.register(editPage) def redirect_url(request, url): if request.META['QUERY_STRING']: diff --git a/static/js/pandora/ui/info.js b/static/js/pandora/ui/info.js index c27f2224..ff6d0e2e 100644 --- a/static/js/pandora/ui/info.js +++ b/static/js/pandora/ui/info.js @@ -118,18 +118,41 @@ pandora.ui.info = function() { }; -pandora.ui.listInfo = function(data) { +pandora.ui.listInfo = function(list) { var that = $('
').css({padding: '16px', textAlign: 'center'}); var $icon = $('') .attr({ - src: !pandora.user.ui._list - ? '/static/png/icon256.png' - : '/list/' + pandora.user.ui._list + '/icon256.jpg?' + Ox.uid() + src: list + ? '/list/' + list + '/icon256.jpg?' + Ox.uid() + : '/static/png/icon256.png' }) .css(getIconCSS()) - .appendTo(that); - $('
').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(!pandora.user.ui._list ? 'All Movies' : pandora.user.ui._list.replace(':', ': ')).appendTo(that); - $('
').css({textAlign: 'left'}).html(Ox.repeat('This is the list info text. ', 10)).appendTo(that); + .appendTo(that), + title = list ? list.replace(':', ': ') : 'All ' + pandora.site.itemName.plural, + description = ''; + + $('
').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(title).appendTo(that); + //fixme: allow editing + //pandora.api.editList({id: list, description: 'foobbar'}, callback) + //pandora.api.editPage({name: 'allItems', body: 'foobar'}, callback) + if(list) { + pandora.api.findLists({ + query: { conditions: [{key: 'id', value: list, operator:'=='}] }, + keys:['description'] + }, function(result) { + $('
').css({textAlign: 'left'}) + .html(result.data.items[0].description) + .appendTo(that); + }); + } + else { + pandora.api.getPage({name: 'allItems'}, function(result) { + $('
').css({textAlign: 'left'}) + .html(result.data.body) + .appendTo(that); + }); + } + function getIconCSS() { var size = Math.round(pandora.user.ui.sidebarSize / 2); return { @@ -140,7 +163,7 @@ pandora.ui.listInfo = function(data) { } that.resizeIcon = function() { $icon.css(getIconCSS()); - } + }; return that; };