Skip to content

Commit

Permalink
bootstrap select -> inline
Browse files Browse the repository at this point in the history
  • Loading branch information
eapearson committed Oct 22, 2021
1 parent 9ea17c4 commit d1d796f
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,20 @@ define([
}

renderHeader() {
const selector = e('select', {
onChange: this.selectItem.bind(this),
className: 'form-control'
}, this.props.items.map(({ label, ref, objectInfo }, index) => {
if (label) {
return e('option', { value: String(index), key: ref }, objectInfo.name, ' (', label, ')');
} else {
return e('option', { value: String(index), key: ref }, objectInfo.name);
}
}));
// All this boilerplate to is to get the select to auto-width in the official bootstrap way
// (rather than overriding styles)
const selector = e('form', { className: 'form-inline' },
e('div', { className: 'form-group' },
e('select', {
onChange: this.selectItem.bind(this),
className: 'form-control'
}, this.props.items.map(({ label, ref, objectInfo }, index) => {
if (label) {
return e('option', { value: String(index), key: ref }, objectInfo.name, ' (', label, ')');
} else {
return e('option', { value: String(index), key: ref }, objectInfo.name);
}
}))));

// NB the ...[] syntax is just to make eslint happier.
return e('div', {
Expand Down

0 comments on commit d1d796f

Please sign in to comment.