PLT-7: Refactoring frontend (chunk 11)

- channel view
- Added translations for previous commits
- Fix bug on signup_team email body
Этот коммит содержится в:
Elias Nahum
2016-02-03 00:46:56 -03:00
родитель f7fddd6cce
Коммит 6a3806fe9d
20 изменённых файлов: 583 добавлений и 127 удалений

Просмотреть файл

@@ -21,12 +21,33 @@ import SocketStore from '../stores/socket_store.jsx';
import Constants from '../utils/constants.jsx';
import {intlShape, injectIntl, defineMessages, FormattedHTMLMessage} from 'mm-intl';
const Preferences = Constants.Preferences;
const TutorialSteps = Constants.TutorialSteps;
const ActionTypes = Constants.ActionTypes;
const KeyCodes = Constants.KeyCodes;
export default class CreatePost extends React.Component {
const holders = defineMessages({
comment: {
id: 'create_post.comment',
defaultMessage: 'Comment'
},
post: {
id: 'create_post.post',
defaultMessage: 'Post'
},
write: {
id: 'create_post.write',
defaultMessage: 'Write a message...'
},
deleteMsg: {
id: 'create_post.deleteMsg',
defaultMessage: '(message deleted)'
}
});
class CreatePost extends React.Component {
constructor(props) {
super(props);
@@ -49,6 +70,7 @@ export default class CreatePost extends React.Component {
this.sendMessage = this.sendMessage.bind(this);
PostStore.clearDraftUploads();
PostStore.deleteMessage(this.props.intl.formatMessage(holders.deleteMsg));
const draft = this.getCurrentDraft();
@@ -361,7 +383,8 @@ export default class CreatePost extends React.Component {
if (!lastPost) {
return;
}
var type = (lastPost.root_id && lastPost.root_id.length > 0) ? 'Comment' : 'Post';
const {formatMessage} = this.props.intl;
var type = (lastPost.root_id && lastPost.root_id.length > 0) ? formatMessage(holders.comment) : formatMessage(holders.post);
AppDispatcher.handleViewAction({
type: ActionTypes.RECIEVED_EDIT_POST,
@@ -379,9 +402,10 @@ export default class CreatePost extends React.Component {
screens.push(
<div>
<h4>{'Sending Messages'}</h4>
<p>{'Type here to write a message and press '}<strong>{'Enter'}</strong>{' to post it.'}</p>
<p>{'Click the '}<strong>{'Attachment'}</strong>{' button to upload an image or a file.'}</p>
<FormattedHTMLMessage
id='create_post.tutorialTip'
defaultMessage='<h4>Sending Messages</h4><p>Type here to write a message and press <strong>Enter</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>'
/>
</div>
);
@@ -445,7 +469,7 @@ export default class CreatePost extends React.Component {
onKeyDown={this.handleKeyDown}
onHeightChange={this.resizePostHolder}
messageText={this.state.messageText}
createMessage='Write a message...'
createMessage={this.props.intl.formatMessage(holders.write)}
channelId={this.state.channelId}
id='post_textbox'
ref='textbox'
@@ -482,3 +506,9 @@ export default class CreatePost extends React.Component {
);
}
}
CreatePost.propTypes = {
intl: intlShape.isRequired
};
export default injectIntl(CreatePost);