mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Allow a default value to be specified for enum properties (#26529)
Why this change?
For a `typed: objects` theme setting with an enum property, we are
adding a `default` key for `type: enum` fields which will be used
as the default value on the client side.
```
some_objects_setting:
type: objects
schema:
name: field
properties:
enum_field:
type: enum
default: awesome
choices:
- nice
- cool
- awesome
```
This commit is contained in:
committed by
GitHub
parent
67a8080e33
commit
de5ca63eb5
@@ -5,7 +5,7 @@ import FieldInputDescription from "admin/components/schema-theme-setting/field-i
|
||||
import ComboBox from "select-kit/components/combo-box";
|
||||
|
||||
export default class SchemaThemeSettingTypeEnum extends Component {
|
||||
@tracked value = this.args.value;
|
||||
@tracked value = this.args.value || this.args.spec.default;
|
||||
|
||||
get content() {
|
||||
return this.args.spec.choices.map((choice) => {
|
||||
|
||||
Reference in New Issue
Block a user