2017-03-23 16:27:59 +09:00
|
|
|
import { Components, registerComponent, withCurrentUser } from 'meteor/vulcan:core';
|
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-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-11-15 18:33:16 +01:00
|
|
|
const size = props.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 (
|
2017-01-30 19:46:48 +09:00
|
|
|
<Components.ModalTrigger size={size} title={context.intl.formatMessage({id: "posts.new_post"})} component={button}>
|
2016-12-06 18:06:29 +01:00
|
|
|
<Components.PostsNewForm />
|
2017-01-30 19:46:48 +09:00
|
|
|
</Components.ModalTrigger>
|
2016-03-25 10:45:28 +09:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2016-05-22 16:42:24 +09:00
|
|
|
PostsNewButton.displayName = "PostsNewButton";
|
|
|
|
|
2016-11-15 18:33:16 +01:00
|
|
|
PostsNewButton.propTypes = {
|
2016-06-10 10:25:38 +09:00
|
|
|
currentUser: React.PropTypes.object,
|
2016-11-15 18:33:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
PostsNewButton.contextTypes = {
|
2016-06-15 11:30:48 +02:00
|
|
|
messages: React.PropTypes.object,
|
2016-06-09 17:42:20 +09:00
|
|
|
intl: intlShape
|
2016-11-15 18:33:16 +01:00
|
|
|
};
|
2016-06-09 17:42:20 +09:00
|
|
|
|
2017-02-02 16:18:33 +01:00
|
|
|
registerComponent('PostsNewButton', PostsNewButton, withCurrentUser);
|