From 4ae9b3042a6821c5b8b99527987782cf061d07f1 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 12 Feb 2014 12:04:40 +0000 Subject: [PATCH] replace item menu once all folders have loaded (and listData is available) --- static/js/folders.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/static/js/folders.js b/static/js/folders.js index e98036c6b..4a47685b5 100644 --- a/static/js/folders.js +++ b/static/js/folders.js @@ -10,12 +10,13 @@ pandora.ui.folders = function(section) { pandora.resizeFolders(); } }), - counter = 0, editable = (ui[ section == 'items' ? '_list' : section.slice(0, -1) ] || '').split(':')[0] == pandora.user.username, folderItems = section == 'items' ? 'Lists' : Ox.toTitleCase(section), - folderItem = folderItems.slice(0, -1); + folderItem = folderItems.slice(0, -1), + initCounter = 0, + loadCounter = 0; pandora.$ui.allItems = pandora.ui.allItems(section).appendTo(that); pandora.$ui.folder = []; pandora.$ui.folderBrowser = {}; @@ -343,13 +344,18 @@ pandora.ui.folders = function(section) { }) .bindEventOnce({ init: function(data) { - if (++counter == pandora.site.sectionFolders[section].length) { + if (++initCounter == pandora.site.sectionFolders[section].length) { pandora.$ui.folder.forEach(function($folder) { that.append($folder); }); pandora.resizeFolders(section); pandora.selectList(); } + }, + load: function(data) { + if (++loadCounter == pandora.site.sectionFolders[section].length) { + pandora.$ui.mainMenu.replaceItemMenu(); + } } }) .appendTo(pandora.$ui.folder[i].$content);