diff options
author | Corey Hulen <corey@hulen.com> | 2016-01-24 22:21:51 -0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-01-24 22:21:51 -0500 |
commit | 711594f227aa9f30e262d243d2e549ef201f24f3 (patch) | |
tree | 20787c260b429ab31ec707f4cbaca92f77c0cfc1 /web/react/pages/admin_console.jsx | |
parent | 2cfe6651922bf26f3e4d47d4caeda8aaeea1f47f (diff) | |
parent | 6d30f3b14c3f446224daf562df9e63f29583794b (diff) | |
download | chat-711594f227aa9f30e262d243d2e549ef201f24f3.tar.gz chat-711594f227aa9f30e262d243d2e549ef201f24f3.tar.bz2 chat-711594f227aa9f30e262d243d2e549ef201f24f3.zip |
Merge pull request #1970 from mattermost/PLT-7-client-infra3
PLT-7 client infra for loc
Diffstat (limited to 'web/react/pages/admin_console.jsx')
-rw-r--r-- | web/react/pages/admin_console.jsx | 77 |
1 files changed, 60 insertions, 17 deletions
diff --git a/web/react/pages/admin_console.jsx b/web/react/pages/admin_console.jsx index cbd2bd80d..3f4c39934 100644 --- a/web/react/pages/admin_console.jsx +++ b/web/react/pages/admin_console.jsx @@ -4,25 +4,68 @@ import ErrorBar from '../components/error_bar.jsx'; import SelectTeamModal from '../components/admin_console/select_team_modal.jsx'; import AdminController from '../components/admin_console/admin_controller.jsx'; +import * as Client from '../utils/client.jsx'; -export function setupAdminConsolePage(props) { - ReactDOM.render( - <AdminController - tab={props.ActiveTab} - teamId={props.TeamId} - />, - document.getElementById('admin_controller') - ); +var IntlProvider = ReactIntl.IntlProvider; - ReactDOM.render( - <SelectTeamModal />, - document.getElementById('select_team_modal') - ); +class Root extends React.Component { + constructor() { + super(); + this.state = { + translations: null, + loaded: false + }; + } - ReactDOM.render( - <ErrorBar/>, - document.getElementById('error_bar') - ); + static propTypes() { + return { + map: React.PropTypes.object.isRequired + }; + } + + componentWillMount() { + Client.getTranslations( + this.props.map.Locale, + (data) => { + this.setState({ + translations: data, + loaded: true + }); + }, + () => { + this.setState({ + loaded: true + }); + } + ); + } + + render() { + if (!this.state.loaded) { + return <div></div>; + } + + return ( + <IntlProvider + locale={this.props.map.Locale} + messages={this.state.translations} + > + <div> + <ErrorBar/> + <AdminController + tab={this.props.map.ActiveTab} + teamId={this.props.map.TeamId} + /> + <SelectTeamModal /> + </div> + </IntlProvider> + ); + } } -global.window.setup_admin_console_page = setupAdminConsolePage; +global.window.setup_admin_console_page = function setup(props) { + ReactDOM.render( + <Root map={props} />, + document.getElementById('admin_controller') + ); +}; |