Vulcan/packages/nova-base-components/lib/posts/PostsNewForm.jsx
Sacha Greif 6665a7c968 making component names and class names more consistent.
- Posts, Comments, Users, etc. are always pluralized.
- CSS classes are based off component names (PostsTitle -> posts-title)
2016-04-19 15:45:36 +09:00

36 lines
No EOL
922 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 PostsNewForm = (props, context) => {
({CanCreatePost, FlashMessages} = Telescope.components);
return (
<CanCreatePost>
<div className="posts-new-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>
)
}
PostsNewForm.contextTypes = {
currentUser: React.PropTypes.object
};
module.exports = PostsNewForm;
export default PostsNewForm;