mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 12:16:37 -04:00
35 lines
868 B
JavaScript
35 lines
868 B
JavaScript
import PublicationUtils from 'meteor/utilities:smart-publications';
|
|
|
|
Posts.addField(
|
|
{
|
|
fieldName: 'categories',
|
|
fieldSchema: {
|
|
type: [String],
|
|
control: "checkboxgroup",
|
|
optional: true,
|
|
insertableIf: Users.is.memberOrAdmin,
|
|
editableIf: Users.is.ownerOrAdmin,
|
|
autoform: {
|
|
noselect: true,
|
|
type: "bootstrap-category",
|
|
order: 50,
|
|
options: function () {
|
|
var categories = Categories.find().map(function (category) {
|
|
return {
|
|
value: category._id,
|
|
label: category.name
|
|
};
|
|
});
|
|
return categories;
|
|
}
|
|
},
|
|
publish: true,
|
|
join: {
|
|
joinAs: "categoriesArray",
|
|
collection: () => Categories
|
|
}
|
|
}
|
|
}
|
|
);
|
|
|
|
PublicationUtils.addToFields(Posts.publishedFields.list, ["categories"]);
|