replace item menu once all folders have loaded (and listData is available)

This commit is contained in:
rolux 2014-02-12 12:04:40 +00:00
parent eb0575798e
commit 4ae9b3042a

View file

@ -10,12 +10,13 @@ pandora.ui.folders = function(section) {
pandora.resizeFolders(); pandora.resizeFolders();
} }
}), }),
counter = 0,
editable = (ui[ editable = (ui[
section == 'items' ? '_list' : section.slice(0, -1) section == 'items' ? '_list' : section.slice(0, -1)
] || '').split(':')[0] == pandora.user.username, ] || '').split(':')[0] == pandora.user.username,
folderItems = section == 'items' ? 'Lists' : Ox.toTitleCase(section), 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.allItems = pandora.ui.allItems(section).appendTo(that);
pandora.$ui.folder = []; pandora.$ui.folder = [];
pandora.$ui.folderBrowser = {}; pandora.$ui.folderBrowser = {};
@ -343,13 +344,18 @@ pandora.ui.folders = function(section) {
}) })
.bindEventOnce({ .bindEventOnce({
init: function(data) { init: function(data) {
if (++counter == pandora.site.sectionFolders[section].length) { if (++initCounter == pandora.site.sectionFolders[section].length) {
pandora.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
pandora.resizeFolders(section); pandora.resizeFolders(section);
pandora.selectList(); pandora.selectList();
} }
},
load: function(data) {
if (++loadCounter == pandora.site.sectionFolders[section].length) {
pandora.$ui.mainMenu.replaceItemMenu();
}
} }
}) })
.appendTo(pandora.$ui.folder[i].$content); .appendTo(pandora.$ui.folder[i].$content);