[explore-v2] control panel fixes (#1529)

* make fieldset conditions more clear

* make label required

* use render* pattern

* use slugify util for turning labels into ids

* use field rather than html

* don't need panel-title class here
This commit is contained in:
Alanna Scott
2016-11-02 21:51:56 -07:00
committed by GitHub
parent ae46561648
commit 4156ad5a30
6 changed files with 32 additions and 18 deletions

View File

@@ -40,22 +40,25 @@ export default class FieldSet extends React.Component {
render() {
const type = this.props.type;
let html;
const selectTypes = [
'SelectField',
'SelectCustomMultiField',
'SelectMultipleSortableField',
'FreeFormSelectField',
];
let field;
if (type === 'CheckboxField') {
html = this.renderCheckBoxField();
} else if (type === 'SelectField' ||
type === 'SelectCustomMultiField' ||
type === 'SelectMultipleSortableField' ||
type === 'FreeFormSelectField') {
html = this.renderSelectField();
} else if (type === 'TextField' || type === 'IntegerField') {
html = this.renderTextField();
field = this.renderCheckBoxField();
} else if (selectTypes.includes(type)) {
field = this.renderSelectField();
} else if (['TextField', 'IntegerField'].includes(type)) {
field = this.renderTextField();
} else if (type === 'TextAreaField') {
this.renderTextAreaField();
field = this.renderTextAreaField();
}
return html;
return field;
}
}