From c5617e10e3bba9be954458a8cfda57533e1bed3f Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 8 Nov 2011 09:46:30 +0000 Subject: [PATCH] when doubleclicking list info icon, delay opening the dialog until list folders have loaded (and the dialog can actually get the list data) --- static/js/pandora/info.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index a18c1a03..5611fc35 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -155,9 +155,7 @@ pandora.ui.listInfo = function() { $title, $description; editable && $icon.bindEvent({ - doubleclick: function() { - pandora.$ui.listDialog = pandora.ui.listDialog('icon').open(); - } + doubleclick: editIcon }); that.append($('
').css({height: '16px'})); @@ -264,6 +262,16 @@ pandora.ui.listInfo = function() { ); } + function editIcon() { + // timeout is needed since if the icon is clicked before the list + // folders have loaded, the list dialog cannot get the list data yet. + if (pandora.getListData().id) { + pandora.$ui.listDialog = pandora.ui.listDialog('icon').open(); + } else { + setTimeout(editIcon, 250); + } + } + function getIconCSS() { var size = Math.round(pandora.user.ui.sidebarSize / 2); return {