summaryrefslogtreecommitdiffstats
path: root/web/react/components/rename_team_modal.jsx
diff options
context:
space:
mode:
authorReed Garmsen <rgarmsen2295@gmail.com>2015-08-21 16:36:53 -0700
committerReed Garmsen <rgarmsen2295@gmail.com>2015-08-24 08:36:55 -0700
commitbf82facd5afd6e2c71845f5732654069554c3a16 (patch)
tree14902e0ea04f079b28210d90f423806b8b2c2dea /web/react/components/rename_team_modal.jsx
parent3e73ff25d35bf5638aabe70b8596b8c80eb0882b (diff)
downloadchat-bf82facd5afd6e2c71845f5732654069554c3a16.tar.gz
chat-bf82facd5afd6e2c71845f5732654069554c3a16.tar.bz2
chat-bf82facd5afd6e2c71845f5732654069554c3a16.zip
Moved the ability to rename a team into the team settings modal; fixed issues with valet settings
Diffstat (limited to 'web/react/components/rename_team_modal.jsx')
-rw-r--r--web/react/components/rename_team_modal.jsx95
1 files changed, 0 insertions, 95 deletions
diff --git a/web/react/components/rename_team_modal.jsx b/web/react/components/rename_team_modal.jsx
deleted file mode 100644
index bebdd6662..000000000
--- a/web/react/components/rename_team_modal.jsx
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-var Client = require('../utils/client.jsx');
-var utils = require('../utils/utils.jsx');
-
-module.exports = React.createClass({
- handleSubmit: function(e) {
- e.preventDefault();
-
- var state = { server_error: "" };
- var valid = true;
-
- var name = this.state.name.trim();
- if (!name) {
- state.name_error = "This field is required";
- valid = false;
- } else {
- state.name_error = "";
- }
-
- this.setState(state);
-
- if (!valid)
- return;
-
- if (this.props.teamDisplayName === name)
- return;
-
- var data = {};
- data["new_name"] = name;
-
- Client.updateTeamDisplayName(data,
- function(data) {
- $('#rename_team_link').modal('hide');
- window.location.reload();
- }.bind(this),
- function(err) {
- state.server_error = err.message;
- this.setState(state);
- }.bind(this)
- );
- },
- onNameChange: function() {
- this.setState({ name: this.refs.name.getDOMNode().value })
- },
- handleClose: function() {
- this.setState({ name: this.props.teamDisplayName, name_error: "", server_error: ""});
- },
- componentDidMount: function() {
- $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', this.handleClose);
- },
- componentWillUnmount: function() {
- $(this.refs.modal.getDOMNode()).off('hidden.bs.modal', this.handleClose);
- },
- getInitialState: function() {
- return { name: this.props.teamDisplayName };
- },
- render: function() {
-
- var name_error = this.state.name_error ? <label className='control-label'>{ this.state.name_error }</label> : null;
- var server_error = this.state.server_error ? <div className='form-group has-error'><label className='control-label'>{ this.state.server_error }</label></div> : null;
-
- return (
- <div className="modal fade" ref="modal" id="rename_team_link" tabIndex="-1" role="dialog" aria-hidden="true">
- <div className="modal-dialog">
- <div className="modal-content">
- <div className="modal-header">
- <button type="button" className="close" data-dismiss="modal">
- <span aria-hidden="true">&times;</span>
- <span className="sr-only">Close</span>
- </button>
- <h4 className="modal-title">{"Rename " + utils.toTitleCase(strings.Team)}</h4>
- </div>
- <div className="modal-body">
- <form role="form" onSubmit={this.handleSubmit}>
- <div className={ this.state.name_error ? "form-group has-error" : "form-group" }>
- <label className='control-label'>Name</label>
- <input onChange={this.onNameChange} type="text" ref="name" className="form-control" placeholder={"Enter "+strings.Team+" name"} value={this.state.name} maxLength="64" />
- { name_error }
- </div>
- { server_error }
- </form>
- </div>
- <div className="modal-footer">
- <button type="button" className="btn btn-default" data-dismiss="modal">Cancel</button>
- <button onClick={this.handleSubmit} type="button" className="btn btn-primary">Save</button>
- </div>
- </div>
- </div>
- </div>
- );
- }
-});
-