Vulcan/packages/nova-core/lib/components/NewDocumentForm.jsx

58 lines
No EOL
1.7 KiB
JavaScript

// import Messages from "../messages.js";
// import NovaForms from "../forms.jsx";
// import Formsy from 'formsy-react';
// const NewDocumentForm = React.createClass({
// propTypes: {
// currentUser: React.PropTypes.object.isRequired,
// collection: React.PropTypes.object.isRequired,
// label: React.PropTypes.string,
// callback: React.PropTypes.func,
// methodName: React.PropTypes.string
// },
// getInitialState() {
// return {
// canSubmit: false
// }
// },
// submitForm(data) {
// // remove any empty properties
// const document = _.compactObject(data);
// const collection = this.props.collection;
// const methodName = this.props.methodName ? this.props.methodName : collection._name+'.create';
// Meteor.call(methodName, document, (error, document) => {
// if (error) {
// console.log(error)
// Messages.flash(error.message, "error")
// } else {
// Messages.flash("Document created.", "success");
// if (this.props.callback) {
// this.props.callback(document);
// }
// }
// });
// },
// render() {
// const collection = this.props.collection;
// const fields = collection.simpleSchema().getEditableFields(this.props.currentUser);
// return (
// <div className="new-document">
// <h3>{this.props.label}</h3>
// <Formsy.Form onSubmit={this.submitForm}>
// {fields.map(fieldName => NovaForms.getComponent(fieldName, collection.simpleSchema()._schema[fieldName]))}
// <button type="submit" className="button button--primary">Submit</button>
// </Formsy.Form>
// </div>
// )
// }
// });
// module.exports = NewDocumentForm;