|
|
@ -262,9 +262,7 @@ function getCategoryData(cids, uid, selectedCid, callback) {
|
|
|
|
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'link', 'color', 'bgColor', 'parentCid', 'image', 'imageClass'], next);
|
|
|
|
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'link', 'color', 'bgColor', 'parentCid', 'image', 'imageClass'], next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
function (categoryData, next) {
|
|
|
|
function (categoryData, next) {
|
|
|
|
categoryData = categoryData.filter(function (category) {
|
|
|
|
categoryData = categoryData.filter(category => category && !category.link);
|
|
|
|
return category && !category.link;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var selectedCategory = [];
|
|
|
|
var selectedCategory = [];
|
|
|
|
var selectedCids = [];
|
|
|
|
var selectedCids = [];
|
|
|
|
categoryData.forEach(function (category) {
|
|
|
|
categoryData.forEach(function (category) {
|
|
|
@ -272,12 +270,10 @@ function getCategoryData(cids, uid, selectedCid, callback) {
|
|
|
|
category.parentCid = category.hasOwnProperty('parentCid') && utils.isNumber(category.parentCid) ? category.parentCid : 0;
|
|
|
|
category.parentCid = category.hasOwnProperty('parentCid') && utils.isNumber(category.parentCid) ? category.parentCid : 0;
|
|
|
|
if (category.selected) {
|
|
|
|
if (category.selected) {
|
|
|
|
selectedCategory.push(category);
|
|
|
|
selectedCategory.push(category);
|
|
|
|
selectedCids.push(parseInt(category.cid, 10));
|
|
|
|
selectedCids.push(category.cid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
selectedCids.sort(function (a, b) {
|
|
|
|
selectedCids.sort((a, b) => a - b);
|
|
|
|
return a - b;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (selectedCategory.length > 1) {
|
|
|
|
if (selectedCategory.length > 1) {
|
|
|
|
selectedCategory = {
|
|
|
|
selectedCategory = {
|
|
|
|