2016-03-31 09:36:25 +09:00
|
|
|
import React, { PropTypes, Component } from 'react';
|
|
|
|
import Router from '../router.js'
|
|
|
|
|
|
|
|
import Core from "meteor/nova:core";
|
|
|
|
const Messages = Core.Messages;
|
|
|
|
|
2016-04-04 10:21:18 +09:00
|
|
|
import NovaForm from "meteor/nova:forms";
|
2016-03-31 09:36:25 +09:00
|
|
|
|
|
|
|
const PostNewForm = (props, context) => {
|
|
|
|
|
|
|
|
({CanCreatePost, FlashMessages} = Telescope.components);
|
2016-04-05 18:05:41 +09:00
|
|
|
|
2016-03-31 09:36:25 +09:00
|
|
|
return (
|
2016-04-05 18:05:41 +09:00
|
|
|
<CanCreatePost>
|
2016-03-31 09:36:25 +09:00
|
|
|
<div className="new-post-form">
|
2016-04-04 10:21:18 +09:00
|
|
|
<NovaForm
|
2016-03-31 09:36:25 +09:00
|
|
|
collection={Posts}
|
|
|
|
currentUser={context.currentUser}
|
|
|
|
methodName="posts.new"
|
|
|
|
successCallback={(post)=>{
|
|
|
|
Messages.flash("Post created.", "success");
|
|
|
|
Router.go('posts.single', post);
|
|
|
|
}}
|
2016-04-01 12:38:50 +09:00
|
|
|
labelFunction={(fieldName)=>Telescope.utils.getFieldLabel(fieldName, Posts)}
|
2016-03-31 09:36:25 +09:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</CanCreatePost>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
PostNewForm.contextTypes = {
|
|
|
|
currentUser: React.PropTypes.object
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = PostNewForm;
|
|
|
|
export default PostNewForm;
|