Vulcan/packages/vulcan-categories/lib/custom_fields.js

31 lines
668 B
JavaScript
Raw Normal View History

2017-03-23 16:27:59 +09:00
import Posts from "meteor/vulcan:posts";
import { getCategoriesAsOptions } from './schema.js';
Posts.addField([
{
fieldName: 'categories',
fieldSchema: {
type: Array,
2016-02-25 17:44:43 +09:00
control: "checkboxgroup",
optional: true,
insertableBy: ['members'],
editableBy: ['members'],
viewableBy: ['guests'],
form: {
noselect: true,
type: "bootstrap-category",
2015-10-20 14:34:24 +09:00
order: 50,
options: formProps => getCategoriesAsOptions(formProps.client),
},
resolveAs: 'categories: [Category]'
}
},
{
fieldName: 'categories.$',
fieldSchema: {
type: String,
optional: true
}
}
]);