import React, { PropTypes, Component } from 'react'; import ReactForms from "meteor/nova:forms"; const EditDocument = ReactForms.EditDocument; import Core from "meteor/nova:core"; const Messages = Core.Messages; import Actions from "../actions.js"; class PostEditForm extends Component{ constructor() { super(); this.deletePost = this.deletePost.bind(this); } deletePost() { const post = this.props.post; if (window.confirm(`Delete post “${post.title}”?`)) { Actions.call('posts.deleteById', post._id, function(){ Messages.flash(`Post “${post.title}” deleted.`, "success"); Events.track("post deleted", {'_id': post._id}); }); } } render() { return (

Edit Post

Delete Post
) } } PostEditForm.propTypes = { post: React.PropTypes.object.isRequired } PostEditForm.contextTypes = { currentUser: React.PropTypes.object }; module.exports = PostEditForm; export default PostEditForm;