fix ui bugs when editing the icon of an empty list (fixes #337)

This commit is contained in:
rolux 2012-03-07 12:54:19 +00:00
parent a0b7ceadd3
commit c552110125

View file

@ -325,6 +325,8 @@ 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],
@ -401,7 +403,7 @@ pandora.ui.listIconPanel = function(listData) {
} else { } else {
itemData = $list.value(posterFrame.item); itemData = $list.value(posterFrame.item);
} }
renderPreview(itemData); posterFrames.length && renderPreview(itemData);
} }
}) })
.gainFocus(); .gainFocus();
@ -411,7 +413,7 @@ pandora.ui.listIconPanel = function(listData) {
function clickIcon(e, isDoubleClick) { function clickIcon(e, isDoubleClick) {
quarter = quarters.indexOf($(e.target).attr('id')); quarter = quarters.indexOf($(e.target).attr('id'));
renderQuarters(); renderQuarters();
if (isDoubleClick) { if (isDoubleClick && posterFrames.length) {
var item = posterFrames[quarter].item; var item = posterFrames[quarter].item;
$list.options({selected: [item]}); $list.options({selected: [item]});
renderPreview($list.value(item), posterFrames[quarter].position); renderPreview($list.value(item), posterFrames[quarter].position);