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,
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({
src: list
? '/list/' + list + '/icon256.jpg?' + Ox.uid()
@ -144,32 +148,50 @@ pandora.ui.listInfo = function() {
.css(getIconCSS())
.appendTo(that);
that.append($('<div>').css({height: '16px'}));
//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']
keys: ['description', 'name', 'user']
}, function(result) {
if (result.data.items.length) {
var item = result.data.items[0];
that.append(
$('<div>')
.css({paddingTop: '16px', fontWeight: 'bold'})
.html(Ox.encodeHTML(list))
Ox.Editable({
editable: item.user == pandora.user.username,
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(
$('<div>')
.css({paddingTop: '16px', textAlign: 'left'})
.html(
result.data.items.length
? result.data.items[0].description
: 'List not found'
)
$('<div>').css({height: '8px'})
).append(
Ox.Editable({
editable: item.user == pandora.user.username,
format: function(value) {
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 {
that.append(
$('<div>')
.css({paddingTop: '16px',})
.css({paddingTop: '16px'})
.html('List not found')
);
}
@ -187,7 +209,7 @@ pandora.ui.listInfo = function() {
return {
width: size + 'px',
height: size + 'px',
borderRadius: Math.round(size / 4) + 'px'
borderRadius: Math.round(size / 4) + 'px',
};
}
that.resizeIcon = function() {

View file

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

View file

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