fix issues with editable state of list icon in info panel (fixes #604)

This commit is contained in:
rolux 2012-03-07 14:06:55 +00:00
parent a5c52f5019
commit ef2b1403bb
2 changed files with 9 additions and 12 deletions

View file

@ -138,12 +138,8 @@ pandora.ui.listInfo = function() {
var list = pandora.user.ui._list, var list = pandora.user.ui._list,
canEditFeaturedLists = pandora.site.capabilities.canEditFeaturedLists[pandora.user.level], canEditFeaturedLists = pandora.site.capabilities.canEditFeaturedLists[pandora.user.level],
editable = list.split(':')[0] == pandora.user.username || canEditFeaturedLists,
that = $('<div>').css({padding: '16px', textAlign: 'center'}), that = $('<div>').css({padding: '16px', textAlign: 'center'}),
$icon = Ox.Element({ $icon = Ox.Element('<img>')
element: '<img>',
tooltip: editable ? 'Doubleclick to edit icon' : '',
})
.attr({ .attr({
src: list src: list
? '/list/' + list + '/icon256.jpg?' + Ox.uid() ? '/list/' + list + '/icon256.jpg?' + Ox.uid()
@ -153,10 +149,6 @@ pandora.ui.listInfo = function() {
.appendTo(that), .appendTo(that),
$title, $description; $title, $description;
editable && $icon.bindEvent({
doubleclick: editIcon
});
that.append($('<div>').css({height: '16px'})); that.append($('<div>').css({height: '16px'}));
//fixme: allow editing //fixme: allow editing
@ -170,7 +162,14 @@ pandora.ui.listInfo = function() {
if (result.data.items.length) { if (result.data.items.length) {
var item = result.data.items[0], var item = result.data.items[0],
editable = item.user == pandora.user.username editable = item.user == pandora.user.username
|| (item.status == 'featured' && canEditFeaturedLists); || (item.status == 'featured' && canEditFeaturedLists);
if (editable) {
$icon.options({
tooltip: 'Doubleclick to edit icon'
}).bindEvent({
doubleclick: editIcon
});
}
that.append( that.append(
$title = Ox.Editable({ $title = Ox.Editable({
editable: editable, editable: editable,

View file

@ -326,8 +326,6 @@ pandora.ui.listIconPanel = function(listData) {
keys: ['posterFrames'] keys: ['posterFrames']
}, function(result) { }, function(result) {
Ox.print('----/----', result.data)
var posterFrames = result.data.items[0].posterFrames, var posterFrames = result.data.items[0].posterFrames,
posterFrame = posterFrames[quarter], posterFrame = posterFrames[quarter],