use list description

This commit is contained in:
j 2011-10-05 19:35:16 +02:00
parent 5c4e5d00b6
commit fbf8424f40
2 changed files with 32 additions and 9 deletions

View file

@ -80,7 +80,7 @@ def editPage(request):
page.save() page.save()
response = json_response({'name': page.name, 'page': page.body}) response = json_response({'name': page.name, 'page': page.body})
return render_to_json_response(response) return render_to_json_response(response)
actions.register(getPage) actions.register(editPage)
def redirect_url(request, url): def redirect_url(request, url):
if request.META['QUERY_STRING']: if request.META['QUERY_STRING']:

View file

@ -118,18 +118,41 @@ pandora.ui.info = function() {
}; };
pandora.ui.listInfo = function(data) { pandora.ui.listInfo = function(list) {
var that = $('<div>').css({padding: '16px', textAlign: 'center'}); var that = $('<div>').css({padding: '16px', textAlign: 'center'});
var $icon = $('<img>') var $icon = $('<img>')
.attr({ .attr({
src: !pandora.user.ui._list src: list
? '/static/png/icon256.png' ? '/list/' + list + '/icon256.jpg?' + Ox.uid()
: '/list/' + pandora.user.ui._list + '/icon256.jpg?' + Ox.uid() : '/static/png/icon256.png'
}) })
.css(getIconCSS()) .css(getIconCSS())
.appendTo(that); .appendTo(that),
$('<div>').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(!pandora.user.ui._list ? 'All Movies' : pandora.user.ui._list.replace(':', ': ')).appendTo(that); title = list ? list.replace(':', ': ') : 'All ' + pandora.site.itemName.plural,
$('<div>').css({textAlign: 'left'}).html(Ox.repeat('This is the list info text. ', 10)).appendTo(that); description = '';
$('<div>').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) {
$('<div>').css({textAlign: 'left'})
.html(result.data.items[0].description)
.appendTo(that);
});
}
else {
pandora.api.getPage({name: 'allItems'}, function(result) {
$('<div>').css({textAlign: 'left'})
.html(result.data.body)
.appendTo(that);
});
}
function getIconCSS() { function getIconCSS() {
var size = Math.round(pandora.user.ui.sidebarSize / 2); var size = Math.round(pandora.user.ui.sidebarSize / 2);
return { return {
@ -140,7 +163,7 @@ pandora.ui.listInfo = function(data) {
} }
that.resizeIcon = function() { that.resizeIcon = function() {
$icon.css(getIconCSS()); $icon.css(getIconCSS());
} };
return that; return that;
}; };