Vulcan/packages/example-permissions/lib/components/comments/CommentsNewForm.jsx
2017-10-06 08:49:36 +09:00

29 lines
No EOL
781 B
JavaScript

/*
A component to configure the "new comment" form.
The "prefilledProps" option lets you prefill specific form fields
(in this case "picId"). This works even if the field is not actually
displayed in the form, as is the case here
(picId's "hidden" property is set to true in the Comments schema)
*/
import React from 'react';
import { Components, registerComponent, getFragment } from 'meteor/vulcan:core';
import Comments from '../../modules/comments/collection.js';
const CommentsNewForm = ({picId}) =>
<div className="comments-new-form">
<Components.SmartForm
collection={Comments}
mutationFragment={getFragment('CommentsItemFragment')}
prefilledProps={{picId}}
/>
</div>
registerComponent('CommentsNewForm', CommentsNewForm);