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

31 lines
664 B
JavaScript
Raw Normal View History

2016-06-23 11:40:35 +09:00
import Posts from "meteor/nova:posts";
import { getCategoriesAsOptions } from './schema.js';
2015-05-17 15:38:02 +09:00
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
}
}
);