From 87d7db3438d46dcd7d84a65739287e25bbb3644f Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Tue, 1 Dec 2015 11:04:24 -0800 Subject: Added legal and support settings to sys console and implemented support for options in app --- .../admin_console/legal_and_support_settings.jsx | 222 +++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 web/react/components/admin_console/legal_and_support_settings.jsx (limited to 'web/react/components/admin_console/legal_and_support_settings.jsx') diff --git a/web/react/components/admin_console/legal_and_support_settings.jsx b/web/react/components/admin_console/legal_and_support_settings.jsx new file mode 100644 index 000000000..b00e4b6bd --- /dev/null +++ b/web/react/components/admin_console/legal_and_support_settings.jsx @@ -0,0 +1,222 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import * as Client from '../../utils/client.jsx'; +import * as AsyncClient from '../../utils/async_client.jsx'; + +export default class LegalAndSupportSettings extends React.Component { + constructor(props) { + super(props); + + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + + this.state = { + saveNeeded: false, + serverError: null + }; + } + + handleChange() { + var s = {saveNeeded: true, serverError: this.state.serverError}; + this.setState(s); + } + + handleSubmit(e) { + e.preventDefault(); + $('#save-button').button('loading'); + + var config = this.props.config; + + config.SupportSettings.TermsOfServiceLink = ReactDOM.findDOMNode(this.refs.TermsOfServiceLink).value.trim(); + config.SupportSettings.PrivacyPolicyLink = ReactDOM.findDOMNode(this.refs.PrivacyPolicyLink).value.trim(); + config.SupportSettings.AboutLink = ReactDOM.findDOMNode(this.refs.AboutLink).value.trim(); + config.SupportSettings.HelpLink = ReactDOM.findDOMNode(this.refs.HelpLink).value.trim(); + config.SupportSettings.ReportAProblemLink = ReactDOM.findDOMNode(this.refs.ReportAProblemLink).value.trim(); + config.SupportSettings.SupportEmail = ReactDOM.findDOMNode(this.refs.SupportEmail).value.trim(); + + Client.saveConfig( + config, + () => { + AsyncClient.getConfig(); + this.setState({ + serverError: null, + saveNeeded: false + }); + $('#save-button').button('reset'); + }, + (err) => { + this.setState({ + serverError: err.message, + saveNeeded: true + }); + $('#save-button').button('reset'); + } + ); + } + + render() { + var serverError = ''; + if (this.state.serverError) { + serverError =
; + } + + var saveClass = 'btn'; + if (this.state.saveNeeded) { + saveClass = 'btn btn-primary'; + } + + return ( +
+ +

{'Legal and Support Settings'}

+
+ +
+ +
+ +

{'Link to Terms of Service available to users on desktop and on mobile. Leaving this blank will hide the option to display a notice.'}

+
+
+ +
+ +
+ +

{'Link to Privacy Policy available to users on desktop and on mobile. Leaving this blank will hide the option to display a notice.'}

+
+
+ +
+ +
+ +

{'Link to About page for more information on your Mattermost deployment, for example its purpose and audience within your organization. Defaults to Mattermost information page.'}

+
+
+ +
+ +
+ +

{'Link to help documentation from team site main menu. Typically not changed unless your organization chooses to create custom documentation.'}

+
+
+ +
+ +
+ +

{'Link to help documentation from team site main menu. By default this points to the peer-to-peer troubleshooting forum where users can search for, find and request help with technical issues.'}

+
+
+ +
+ +
+ +

{'Email shown during tutorial for end users to ask support questions.'}

+
+
+ +
+
+ {serverError} + +
+
+ +
+
+ ); + } +} + +LegalAndSupportSettings.propTypes = { + config: React.PropTypes.object +}; -- cgit v1.2.3-1-g7c22