1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 08:24:28 +02:00

Finish admin permissions page and clean up everything

This commit is contained in:
Toby Zerner
2015-07-31 20:16:47 +09:30
parent 5706c71c86
commit fde7afd3e2
33 changed files with 766 additions and 291 deletions

View File

@@ -0,0 +1,25 @@
import SelectDropdown from 'flarum/components/SelectDropdown';
import Button from 'flarum/components/Button';
import saveConfig from 'flarum/utils/saveConfig';
export default class ConfigDropdown extends SelectDropdown {
static initProps(props) {
super.initProps(props);
props.className = 'ConfigDropdown';
props.buttonClassName = 'Button Button--text';
props.caretIcon = 'caret-down';
props.defaultLabel = 'Custom';
props.children = props.options.map(({value, label}) => {
const active = app.config[props.key] === value;
return Button.component({
children: label,
icon: active ? 'check' : true,
onclick: saveConfig.bind(this, {[props.key]: value}),
active
});
});
}
}