2017-07-19 16:59:41 +09:00
|
|
|
/*
|
|
|
|
|
|
|
|
A component to configure the "edit comment" form.
|
|
|
|
|
|
|
|
Components.SmartForm props:
|
|
|
|
|
|
|
|
- collection: the collection in which to edit a document
|
|
|
|
- documentId: the id of the document to edit
|
|
|
|
- mutationFragment: the GraphQL fragment defining the data returned by the mutation
|
|
|
|
- showRemove: whether to show the "delete document" action in the form
|
|
|
|
- successCallback: what to do after the mutation succeeds
|
|
|
|
|
|
|
|
Note: `closeModal` is available as a prop because this form will be opened
|
|
|
|
in a modal popup.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { Components, registerComponent, getFragment } from "meteor/vulcan:core";
|
|
|
|
|
|
|
|
import Comments from '../../modules/comments/collection.js';
|
|
|
|
|
|
|
|
const CommentsEditForm = ({documentId, closeModal}) =>
|
|
|
|
|
|
|
|
<Components.SmartForm
|
|
|
|
collection={Comments}
|
|
|
|
documentId={documentId}
|
|
|
|
mutationFragment={getFragment('CommentsItemFragment')}
|
|
|
|
showRemove={true}
|
|
|
|
successCallback={document => {
|
|
|
|
closeModal();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
2017-10-06 08:49:36 +09:00
|
|
|
registerComponent('CommentsEditForm', CommentsEditForm);
|