From d424c9eaf12653332f15afa2cb9dfc6684fa95d8 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Tue, 2 Feb 2016 19:39:56 -0300 Subject: PLT-7: Refactoring frontend (chunk 10) - Modals - Fix bug on msg_typing - Add missing translations in es.json for EE --- .../components/edit_channel_purpose_modal.jsx | 72 +++++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) (limited to 'web/react/components/edit_channel_purpose_modal.jsx') diff --git a/web/react/components/edit_channel_purpose_modal.jsx b/web/react/components/edit_channel_purpose_modal.jsx index af23342ae..d8354f59d 100644 --- a/web/react/components/edit_channel_purpose_modal.jsx +++ b/web/react/components/edit_channel_purpose_modal.jsx @@ -3,10 +3,19 @@ import * as AsyncClient from '../utils/async_client.jsx'; import * as Client from '../utils/client.jsx'; -import * as Utils from '../utils/utils.jsx'; +import Constants from '../utils/constants.jsx'; + +import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl'; const Modal = ReactBootstrap.Modal; +const holders = defineMessages({ + error: { + id: 'edit_channel_purpose_modal.error', + defaultMessage: 'This channel purpose is too long, please enter a shorter one' + } +}); + export default class EditChannelPurposeModal extends React.Component { constructor(props) { super(props); @@ -48,8 +57,8 @@ export default class EditChannelPurposeModal extends React.Component { this.handleHide(); }, (err) => { - if (err.message === 'Invalid channel_purpose parameter') { - this.setState({serverError: 'This channel purpose is too long, please enter a shorter one'}); + if (err.id === 'api.context.invalid_param.app_error') { + this.setState({serverError: this.props.intl.formatMessage(holders.error)}); } else { this.setState({serverError: err.message}); } @@ -72,9 +81,39 @@ export default class EditChannelPurposeModal extends React.Component { ); } - let title = {'Edit Purpose'}; + let title = ( + + + + ); if (this.props.channel.display_name) { - title = {'Edit Purpose for '}{this.props.channel.display_name}; + title = ( + + + {this.props.channel.display_name} + + ); + } + + let channelType = ( + + ); + if (this.props.channel.type === Constants.PRIVATE_CHANNEL) { + channelType = ( + + ); } return ( @@ -90,7 +129,15 @@ export default class EditChannelPurposeModal extends React.Component { -

{`Describe how this ${Utils.getChannelTerm(this.props.channel.channelType)} should be used. This text appears in the channel list in the "More..." menu and helps others decide whether to join.`}

+

+ +