diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 4f3d03bc..60a899f4 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -550,7 +550,7 @@ View.Outfits = function (wardrobe) { wardrobe.outfits.bind('addOutfit', function (outfit, i) { var next_child = outfits_list_el.children().not('.hiding').eq(i), - outfit_el = $.tmpl('outfitTemplate', outfit); + outfit_el = $.tmpl('outfitTemplate', outfit.clone()); if(next_child.length) { outfit_el.insertBefore(next_child); } else { @@ -558,8 +558,8 @@ View.Outfits = function (wardrobe) { } updateActiveOutfit(); - var naturalWidth = outfit_el.width(); - log("Natural width is", naturalWidth); + var naturalWidth = outfit_el.css('width'); + log("Natural width is", naturalWidth, outfit_el.width()); outfit_el.width(0).animate({width: naturalWidth}, 'normal'); listSubscribeToImage(outfit); }); diff --git a/public/javascripts/wardrobe.js b/public/javascripts/wardrobe.js index fd868482..74991ae0 100644 --- a/public/javascripts/wardrobe.js +++ b/public/javascripts/wardrobe.js @@ -1119,21 +1119,24 @@ function Wardrobe() { var DELAY = 5000; var controller = this; - function checkSubscription(outfit) { - outfit.reload(function () { - if(outfitSubscriptionTotals[outfit.id] > 0) { - if(outfit.image_enqueued) { - log("Outfit image still enqueued; will try again soon", outfit); - setTimeout(function () { checkSubscription(outfit) }, DELAY); + function checkSubscription(outfit_id) { + Outfit.find(outfit_id, function (outfit) { + log("Checking image for", outfit); + outfit.reload(function () { + if(outfitSubscriptionTotals[outfit_id] > 0) { + if(outfit.image_enqueued) { + log("Outfit image still enqueued; will try again soon", outfit); + setTimeout(function () { checkSubscription(outfit_id) }, DELAY); + } else { + // Unsubscribe everyone from this outfit and fire ready events + delete outfitSubscriptionTotals[outfit_id]; + controller.events.trigger('imageReady', outfit); + } } else { - // Unsubscribe everyone from this outfit and fire ready events - delete outfitSubscriptionTotals[outfit.id]; - controller.events.trigger('imageReady', outfit); + log("Outfit was unsubscribed", outfit); + delete outfitSubscriptionTotals[outfit_id]; } - } else { - log("Outfit was unsubscribed", outfit); - delete outfitSubscriptionTotals[outfit.id]; - } + }); }); } @@ -1146,7 +1149,7 @@ function Wardrobe() { } else { // This is a new subscription! Let's start checking it. outfitSubscriptionTotals[outfit.id] = 1; - checkSubscription(outfit); + checkSubscription(outfit.id); } // Regardless, trigger the enqueued event for the new consumer's sake.