|
|
@ -281,8 +281,12 @@ define('admin/manage/category', [
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Category.launchParentSelector = function () {
|
|
|
|
Category.launchParentSelector = function () {
|
|
|
|
|
|
|
|
socket.emit('categories.getSelectCategories', {}, function (err, allCategories) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
var parents = [parseInt(ajaxify.data.category.cid, 10)];
|
|
|
|
var parents = [parseInt(ajaxify.data.category.cid, 10)];
|
|
|
|
var categories = ajaxify.data.allCategories.filter(function (category) {
|
|
|
|
var categories = allCategories.filter(function (category) {
|
|
|
|
var isChild = parents.includes(parseInt(category.parentCid, 10));
|
|
|
|
var isChild = parents.includes(parseInt(category.parentCid, 10));
|
|
|
|
if (isChild) {
|
|
|
|
if (isChild) {
|
|
|
|
parents.push(parseInt(category.cid, 10));
|
|
|
|
parents.push(parseInt(category.cid, 10));
|
|
|
@ -301,7 +305,7 @@ define('admin/manage/category', [
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
return app.alertError(err.message);
|
|
|
|
return app.alertError(err.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var parent = ajaxify.data.allCategories.filter(function (category) {
|
|
|
|
var parent = allCategories.filter(function (category) {
|
|
|
|
return category && parseInt(category.cid, 10) === parseInt(parentCid, 10);
|
|
|
|
return category && parseInt(category.cid, 10) === parseInt(parentCid, 10);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
parent = parent[0];
|
|
|
|
parent = parent[0];
|
|
|
@ -312,6 +316,7 @@ define('admin/manage/category', [
|
|
|
|
$('button[data-action="changeParent"]').html(buttonHtml).parent().removeClass('hide');
|
|
|
|
$('button[data-action="changeParent"]').html(buttonHtml).parent().removeClass('hide');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return Category;
|
|
|
|
return Category;
|
|
|
|