Reformatted team_feature_tab.jsx to meet style guide requirements.
Этот коммит содержится в:
@@ -7,34 +7,24 @@ var SettingItemMax = require('./setting_item_max.jsx');
|
|||||||
var client = require('../utils/client.jsx');
|
var client = require('../utils/client.jsx');
|
||||||
var AsyncClient = require('../utils/async_client.jsx');
|
var AsyncClient = require('../utils/async_client.jsx');
|
||||||
|
|
||||||
module.exports = React.createClass({
|
export default class FeatureTab extends React.Component {
|
||||||
displayName: 'Feature Tab',
|
constructor(props) {
|
||||||
propTypes: {
|
super(props);
|
||||||
updateSection: React.PropTypes.func.isRequired,
|
|
||||||
team: React.PropTypes.object.isRequired,
|
|
||||||
activeSection: React.PropTypes.string.isRequired
|
|
||||||
},
|
|
||||||
submitValetFeature: function() {
|
|
||||||
var data = {};
|
|
||||||
data.allow_valet = this.state.allowValet;
|
|
||||||
|
|
||||||
client.updateValetFeature(data,
|
this.submitValetFeature = this.submitValetFeature.bind(this);
|
||||||
function() {
|
this.handleValetRadio = this.handleValetRadio.bind(this);
|
||||||
this.props.updateSection('');
|
this.onUpdateSection = this.onUpdateSection.bind(this);
|
||||||
AsyncClient.getMyTeam();
|
|
||||||
}.bind(this),
|
this.state = {};
|
||||||
function(err) {
|
var team = this.props.team;
|
||||||
var state = this.getInitialState();
|
|
||||||
state.serverError = err;
|
if (team && team.allow_valet) {
|
||||||
this.setState(state);
|
this.state.allowValet = 'true';
|
||||||
}.bind(this)
|
} else {
|
||||||
);
|
this.state.allowValet = 'false';
|
||||||
},
|
}
|
||||||
handleValetRadio: function(val) {
|
}
|
||||||
this.setState({allowValet: val});
|
componentWillReceiveProps(newProps) {
|
||||||
this.refs.wrapper.getDOMNode().focus();
|
|
||||||
},
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
|
||||||
var team = newProps.team;
|
var team = newProps.team;
|
||||||
|
|
||||||
var allowValet = 'false';
|
var allowValet = 'false';
|
||||||
@@ -43,26 +33,36 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({allowValet: allowValet});
|
this.setState({allowValet: allowValet});
|
||||||
},
|
}
|
||||||
getInitialState: function() {
|
submitValetFeature() {
|
||||||
var team = this.props.team;
|
var data = {};
|
||||||
|
data.allow_valet = this.state.allowValet;
|
||||||
|
|
||||||
var allowValet = 'false';
|
client.updateValetFeature(data,
|
||||||
if (team && team.allow_valet) {
|
function success() {
|
||||||
allowValet = 'true';
|
this.props.updateSection('');
|
||||||
}
|
AsyncClient.getMyTeam();
|
||||||
|
}.bind(this),
|
||||||
return {allowValet: allowValet};
|
function fail(err) {
|
||||||
},
|
var state = this.getInitialState();
|
||||||
onUpdateSection: function(e) {
|
state.serverError = err;
|
||||||
|
this.setState(state);
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
handleValetRadio(val) {
|
||||||
|
this.setState({allowValet: val});
|
||||||
|
this.refs.wrapper.getDOMNode().focus();
|
||||||
|
}
|
||||||
|
onUpdateSection(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (this.props.activeSection === 'valet') {
|
if (this.props.activeSection === 'valet') {
|
||||||
this.props.updateSection('');
|
this.props.updateSection('');
|
||||||
} else {
|
} else {
|
||||||
this.props.updateSection('valet');
|
this.props.updateSection('valet');
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
render: function() {
|
render() {
|
||||||
var clientError = null;
|
var clientError = null;
|
||||||
var serverError = null;
|
var serverError = null;
|
||||||
if (this.state.clientError) {
|
if (this.state.clientError) {
|
||||||
@@ -145,10 +145,25 @@ module.exports = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className='modal-header'>
|
<div className='modal-header'>
|
||||||
<button type='button' className='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>×</span></button>
|
<button
|
||||||
<h4 className='modal-title' ref='title'><i className='modal-back'></i>Advanced Features</h4>
|
type='button'
|
||||||
|
className='close'
|
||||||
|
data-dismiss='modal'
|
||||||
|
aria-label='Close'
|
||||||
|
>
|
||||||
|
<span aria-hidden='true'>×</span>
|
||||||
|
</button>
|
||||||
|
<h4
|
||||||
|
className='modal-title'
|
||||||
|
ref='title'
|
||||||
|
>
|
||||||
|
<i className='modal-back'></i>Advanced Features
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div ref='wrapper' className='user-settings'>
|
<div
|
||||||
|
ref='wrapper'
|
||||||
|
className='user-settings'
|
||||||
|
>
|
||||||
<h3 className='tab-header'>Advanced Features</h3>
|
<h3 className='tab-header'>Advanced Features</h3>
|
||||||
<div className='divider-dark first'/>
|
<div className='divider-dark first'/>
|
||||||
{valetSection}
|
{valetSection}
|
||||||
@@ -157,4 +172,14 @@ module.exports = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
FeatureTab.defaultProps = {
|
||||||
|
team: {},
|
||||||
|
activeSection: ''
|
||||||
|
};
|
||||||
|
FeatureTab.propTypes = {
|
||||||
|
updateSection: React.PropTypes.func.isRequired,
|
||||||
|
team: React.PropTypes.object.isRequired,
|
||||||
|
activeSection: React.PropTypes.string.isRequired
|
||||||
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user