Vulcan/packages/nova-embedly/lib/custom_fields.js
xavcz 1e2d43662d form api, embedly url, fix posts autovalues
- Form API: updateCurrentValue(fieldName, fieldValue) => updateCurrentValues(newValues: {[fieldName]: fieldValue}) to update one or more fields at once;
- changes on EmbedlyURL: use of currentValues instead of autofilledValues, fix the use of 'media' field on new & edit (assigned server-side in async callback)
- fix Posts schema's autoValue logic: moved to callbacks (it worked on new docs but not triggered on edits)
2017-01-23 15:50:55 +01:00

52 lines
1 KiB
JavaScript

import EmbedlyURL from './components/EmbedlyURL.jsx';
import ThumbnailURL from './components/ThumbnailURL.jsx';
import Posts from "meteor/nova:posts";
Posts.addField([
{
fieldName: 'url',
fieldSchema: {
control: EmbedlyURL, // we are just extending the field url, not replacing it
}
},
{
fieldName: 'thumbnailUrl',
fieldSchema: {
type: String,
optional: true,
insertableBy: ['members'],
editableBy: ['members'],
viewableBy: ['guests'],
publish: true,
control: ThumbnailURL
}
},
{
fieldName: 'media',
fieldSchema: {
type: Object,
publish: true,
optional: true,
blackbox: true,
viewableBy: ['guests'],
}
},
{
fieldName: 'sourceName',
fieldSchema: {
type: String,
optional: true,
publish: true,
viewableBy: ['guests'],
}
},
{
fieldName: 'sourceUrl',
fieldSchema: {
type: String,
optional: true,
publish: true,
viewableBy: ['guests'],
}
}
]);