mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +08:00
Add check to register state of '0' as false for checkboxes (#2210)
* Add check to register state of '0' as false for checkboxes * Add comment explaining state === '0'
This commit is contained in:
parent
becc75c5c0
commit
1cfdc23865
|
@ -13,8 +13,8 @@ export default class AppearancePage extends Page {
|
|||
|
||||
this.primaryColor = m.prop(app.data.settings.theme_primary_color);
|
||||
this.secondaryColor = m.prop(app.data.settings.theme_secondary_color);
|
||||
this.darkMode = m.prop(app.data.settings.theme_dark_mode === '1');
|
||||
this.coloredHeader = m.prop(app.data.settings.theme_colored_header === '1');
|
||||
this.darkMode = m.prop(app.data.settings.theme_dark_mode);
|
||||
this.coloredHeader = m.prop(app.data.settings.theme_colored_header);
|
||||
}
|
||||
|
||||
view() {
|
||||
|
|
|
@ -16,6 +16,9 @@ import icon from '../helpers/icon';
|
|||
*/
|
||||
export default class Checkbox extends Component {
|
||||
view() {
|
||||
// Sometimes, false is stored in the DB as '0'. This is a temporary
|
||||
// conversion layer until a more robust settings encoding is introduced
|
||||
if (this.props.state === '0') this.props.state = false;
|
||||
let className = 'Checkbox ' + (this.props.state ? 'on' : 'off') + ' ' + (this.props.className || '');
|
||||
if (this.props.loading) className += ' loading';
|
||||
if (this.props.disabled) className += ' disabled';
|
||||
|
|
Loading…
Reference in New Issue
Block a user