Introduce client settings

This commit is contained in:
John Furrow
2016-06-06 21:01:10 -07:00
parent 30d75c124b
commit 02c3b5e4b0
27 changed files with 907 additions and 206 deletions

View File

@@ -0,0 +1,36 @@
import React from 'react';
const METHODS_TO_BIND = ['handleClientSettingFieldChange'];
export default class SettingsTab extends React.Component {
constructor() {
super();
METHODS_TO_BIND.forEach((method) => {
this[method] = this[method].bind(this);
});
}
getFieldValue(fieldName) {
if (this.state[fieldName] == null) {
return this.props.settings[fieldName] || '';
}
return this.state[fieldName];
}
handleClientSettingFieldChange(fieldName, event) {
let newState = {[fieldName]: event.target.value};
this.setState(newState);
this.props.onClientSettingsChange(newState);
}
handleClientSettingCheckboxChange(fieldName, value) {
let checkedValue = value ? '1' : '0';
let newState = {[fieldName]: checkedValue};
this.setState(newState);
this.props.onClientSettingsChange(newState);
}
}