mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
9d38a0a1e1
refs https://github.com/TryGhost/Team/issues/1106 - removed `'string'` from the `attr()` definition for `customThemeSetting.value` so that we're not coercing the value from the API into something that doesn't work when applied to the `checked` attribute on checkbox inputs - added initial `<CustomThemeSettings::Boolean>` component and used it for display in theme setting forms when `type === 'boolean'`
17 lines
528 B
JavaScript
17 lines
528 B
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {camelize} from '@ember/string';
|
|
import {guidFor} from '@ember/object/internals';
|
|
|
|
export default class CustomThemeSettingsBooleanComponent extends Component {
|
|
checkboxId = `checkbox-${guidFor(this)}`;
|
|
checkboxName = camelize(this.args.setting.key);
|
|
|
|
@action
|
|
toggleValue(changeEvent) {
|
|
const value = changeEvent.target.checked;
|
|
this.args.setting.set('value', value);
|
|
this.args.onChange?.();
|
|
}
|
|
}
|