2016-03-25 10:45:28 +09:00
|
|
|
import React, { PropTypes, Component } from 'react';
|
2016-06-10 10:25:38 +09:00
|
|
|
import { FormattedMessage, intlShape } from 'react-intl';
|
2016-03-25 10:45:28 +09:00
|
|
|
import { Button } from 'react-bootstrap';
|
2016-05-22 15:23:30 +09:00
|
|
|
import { ModalTrigger } from "meteor/nova:core";
|
2016-03-27 13:04:21 +09:00
|
|
|
|
2016-04-14 14:12:06 +09:00
|
|
|
const PostsNewButton = (props, context) => {
|
2016-03-25 10:45:28 +09:00
|
|
|
|
2016-06-10 10:25:38 +09:00
|
|
|
const size = context.currentUser ? "large" : "small";
|
2016-06-09 17:42:20 +09:00
|
|
|
const button = <Button className="posts-new-button" bsStyle="primary"><FormattedMessage id="posts.new_post"/></Button>;
|
2016-03-25 10:45:28 +09:00
|
|
|
return (
|
2016-06-09 17:42:20 +09:00
|
|
|
<ModalTrigger size={size} title={context.intl.formatMessage({id: "posts.new_post"})} component={button}>
|
2016-05-22 16:42:24 +09:00
|
|
|
<Telescope.components.PostsNewForm/>
|
2016-03-25 10:45:28 +09:00
|
|
|
</ModalTrigger>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2016-05-22 16:42:24 +09:00
|
|
|
PostsNewButton.displayName = "PostsNewButton";
|
|
|
|
|
2016-06-09 17:42:20 +09:00
|
|
|
PostsNewButton.contextTypes = {
|
2016-06-10 10:25:38 +09:00
|
|
|
currentUser: React.PropTypes.object,
|
2016-06-15 11:30:48 +02:00
|
|
|
messages: React.PropTypes.object,
|
2016-06-09 17:42:20 +09:00
|
|
|
intl: intlShape
|
|
|
|
}
|
|
|
|
|
2016-04-14 14:12:06 +09:00
|
|
|
module.exports = PostsNewButton;
|
|
|
|
export default PostsNewButton;
|