import React, { PropTypes, Component } from 'react'; import NovaForm from "meteor/nova:forms"; import SmartContainers from "meteor/utilities:react-list-container"; const DocumentContainer = SmartContainers.DocumentContainer; import Core from "meteor/nova:core"; const Messages = Core.Messages; import Actions from "../actions.js"; class PostsEditForm 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, (error, result) => { Messages.flash(`Post “${post.title}” deleted.`, "success"); Events.track("post deleted", {'_id': post._id}); }); } } render() { return (
Telescope.utils.getFieldLabel(fieldName, Posts) }} />
Delete Post
) } } PostsEditForm.propTypes = { post: React.PropTypes.object.isRequired } PostsEditForm.contextTypes = { currentUser: React.PropTypes.object }; module.exports = PostsEditForm; export default PostsEditForm;