mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
32 lines
922 B
JavaScript
32 lines
922 B
JavaScript
import Posts from "meteor/nova:posts";
|
|
|
|
/*
|
|
Let's assign a color to each post (why? cause we want to, that's why).
|
|
We'll do that by adding a custom field to the Posts collection.
|
|
Note that this requires our custom package to depend on nova:posts and nova:users.
|
|
*/
|
|
|
|
Posts.addField(
|
|
{
|
|
fieldName: 'color',
|
|
fieldSchema: {
|
|
type: String,
|
|
control: "select", // use a select form control
|
|
optional: true, // this field is not required
|
|
insertableBy: ['members'],
|
|
editableBy: ['members'],
|
|
viewableBy: ['members'],
|
|
form: {
|
|
options: function () { // options for the select form control
|
|
return [
|
|
{value: "white", label: "White"},
|
|
{value: "yellow", label: "Yellow"},
|
|
{value: "blue", label: "Blue"},
|
|
{value: "red", label: "Red"},
|
|
{value: "green", label: "Green"}
|
|
];
|
|
}
|
|
},
|
|
}
|
|
}
|
|
);
|