improving info and info page

This commit is contained in:
rolux 2011-11-03 17:11:10 +00:00
parent ce15f30ac3
commit 56b1098c60
3 changed files with 51 additions and 25 deletions

View file

@ -135,7 +135,11 @@ pandora.ui.listInfo = function() {
var list = pandora.user.ui._list, var list = pandora.user.ui._list,
that = $('<div>').css({padding: '16px', textAlign: 'center'}), that = $('<div>').css({padding: '16px', textAlign: 'center'}),
$icon = $('<img>') $icon = Ox.Element({
element: '<img>',
tooltip: list.split(':')[0] == pandora.user.username
? 'Doubleclick to edit icon' : '',
})
.attr({ .attr({
src: list src: list
? '/list/' + list + '/icon256.jpg?' + Ox.uid() ? '/list/' + list + '/icon256.jpg?' + Ox.uid()
@ -144,32 +148,50 @@ pandora.ui.listInfo = function() {
.css(getIconCSS()) .css(getIconCSS())
.appendTo(that); .appendTo(that);
that.append($('<div>').css({height: '16px'}));
//fixme: allow editing //fixme: allow editing
//pandora.api.editList({id: list, description: 'foobbar'}, callback) //pandora.api.editList({id: list, description: 'foobbar'}, callback)
//pandora.api.editPage({name: 'allItems', body: 'foobar'}, callback) //pandora.api.editPage({name: 'allItems', body: 'foobar'}, callback)
if (list) { if (list) {
pandora.api.findLists({ pandora.api.findLists({
query: { conditions: [{key: 'id', value: list, operator: '=='}] }, query: { conditions: [{key: 'id', value: list, operator: '=='}] },
keys: ['description'] keys: ['description', 'name', 'user']
}, function(result) { }, function(result) {
if (result.data.items.length) { if (result.data.items.length) {
var item = result.data.items[0];
that.append( that.append(
$('<div>') Ox.Editable({
.css({paddingTop: '16px', fontWeight: 'bold'}) editable: item.user == pandora.user.username,
.html(Ox.encodeHTML(list)) format: function(value) {
return Ox.encodeHTML(item.user + ':' + value)
},
tooltip: item.user == pandora.user.username
? 'Doubleclick to edit title' : '',
value: item.name,
width: pandora.user.ui.sidebarSize - 32
})
.css({fontWeight: 'bold', textAlign: 'center'})
).append( ).append(
$('<div>') $('<div>').css({height: '8px'})
.css({paddingTop: '16px', textAlign: 'left'}) ).append(
.html( Ox.Editable({
result.data.items.length editable: item.user == pandora.user.username,
? result.data.items[0].description format: function(value) {
: 'List not found' return Ox.encodeHTML(value)
) },
placeholder: '<div style="color: rgb(128, 128, 128); text-align: center">No description</span>',
tooltip: 'Doubleclick to edit description',
type: 'textarea',
value: item.description,
width: pandora.user.ui.sidebarSize - 32
})
.css({textAlign: 'left'})
); );
} else { } else {
that.append( that.append(
$('<div>') $('<div>')
.css({paddingTop: '16px',}) .css({paddingTop: '16px'})
.html('List not found') .html('List not found')
); );
} }
@ -187,7 +209,7 @@ pandora.ui.listInfo = function() {
return { return {
width: size + 'px', width: size + 'px',
height: size + 'px', height: size + 'px',
borderRadius: Math.round(size / 4) + 'px' borderRadius: Math.round(size / 4) + 'px',
}; };
} }
that.resizeIcon = function() { that.resizeIcon = function() {

View file

@ -151,6 +151,7 @@ pandora.ui.infoView = function(data) {
}) })
.css({ .css({
display: 'inline-block', display: 'inline-block',
marginBottom: '-3px',
fontWeight: 'bold', fontWeight: 'bold',
fontSize: '13px', fontSize: '13px',
MozUserSelect: 'text', MozUserSelect: 'text',
@ -177,15 +178,15 @@ pandora.ui.infoView = function(data) {
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value) {
return value formatValue(value.split(', '), 'name')
? formatValue(value.split(', '), 'name')
: formatLight('Unknown Director');
}, },
placeholder: formatLight('Unknown Director'),
tooltip: isEditable ? 'Doubleclick to edit' : '', tooltip: isEditable ? 'Doubleclick to edit' : '',
value: data.director ? data.director.join(', ') : 'Unknown Director' value: data.director ? data.director.join(', ') : 'Unknown Director'
}) })
.css({ .css({
display: 'inline-block', display: 'inline-block',
marginBottom: '-3px',
fontWeight: 'bold', fontWeight: 'bold',
fontSize: '13px', fontSize: '13px',
MozUserSelect: 'text', MozUserSelect: 'text',
@ -214,10 +215,9 @@ pandora.ui.infoView = function(data) {
Ox.Editable({ Ox.Editable({
clickLink: pandora.clickLink, clickLink: pandora.clickLink,
format: function(value) { format: function(value) {
return value return formatValue(value.split(', '), key)
? formatValue(value.split(', '), key)
: formatLight('unknown');
}, },
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit', tooltip: 'Doubleclick to edit',
value: key == 'country' value: key == 'country'
? (data[key] ? data[key].join(', ') : ['']) ? (data[key] ? data[key].join(', ') : [''])
@ -452,9 +452,6 @@ pandora.ui.infoView = function(data) {
.append(formatKey('Notes', true)) .append(formatKey('Notes', true))
.append( .append(
Ox.Editable({ Ox.Editable({
format: function(value) {
return value || formatLight('No notes');
},
height: 128, height: 128,
placeholder: formatLight('No notes'), placeholder: formatLight('No notes'),
tooltip: 'Doubleclick to edit', tooltip: 'Doubleclick to edit',

View file

@ -205,8 +205,15 @@ pandora.ui.mainMenu = function() {
set.listSort = pandora.site.user.ui.listSort; set.listSort = pandora.site.user.ui.listSort;
} }
pandora.UI.set(set); pandora.UI.set(set);
} else if (['personallists', 'favoritelists', 'featuredlists'].indexOf(value) > -1) { } else if (['personallists', 'favoritelists', 'featuredlists'].indexOf(data.id) > -1) {
pandora.UI.set({list: value.substr(8)}); pandora.UI.set({
find: {
conditions: value ? [
{key: 'list', value: value.substr(8), operator: '=='}
] : [],
operator: '&'
}
});
} }
}, },
click: function(data) { click: function(data) {