mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
36 lines
No EOL
917 B
JavaScript
36 lines
No EOL
917 B
JavaScript
import React, { PropTypes, Component } from 'react';
|
|
import Router from '../router.js'
|
|
|
|
import Core from "meteor/nova:core";
|
|
const Messages = Core.Messages;
|
|
|
|
import NovaForm from "meteor/nova:forms";
|
|
|
|
const PostNewForm = (props, context) => {
|
|
|
|
({CanCreatePost, FlashMessages} = Telescope.components);
|
|
|
|
return (
|
|
<CanCreatePost>
|
|
<div className="new-post-form">
|
|
<NovaForm
|
|
collection={Posts}
|
|
currentUser={context.currentUser}
|
|
methodName="posts.new"
|
|
successCallback={(post)=>{
|
|
Messages.flash("Post created.", "success");
|
|
Router.go('posts.single', post);
|
|
}}
|
|
labelFunction={(fieldName)=>Telescope.utils.getFieldLabel(fieldName, Posts)}
|
|
/>
|
|
</div>
|
|
</CanCreatePost>
|
|
)
|
|
}
|
|
|
|
PostNewForm.contextTypes = {
|
|
currentUser: React.PropTypes.object
|
|
};
|
|
|
|
module.exports = PostNewForm;
|
|
export default PostNewForm; |