DEV: Open theme settings objects editor from admin customize theme page (#26006)

Why this change?

The `/admin/customize/themes/:id/schema/name` route is a work in
progress but we want to be able to start navigating to it from the
`/admin/customize/themes/:id` route.

What does this change do?

1. Move `adminCustomizeThemes.schema` to a child route of
   `adminCustomizeThemes.show`. This is because we need the model
   from the parent route and if it isn't a child route we end up
   having to load the theme model again from the server.

1. Add the `objects_schema` attribute to `ThemeSettingsSerializer`

1. Refactor `SiteSettingComponent` to be able to render a button
   so that we don't have to hardcode the button rendering into the
   `SiteSettings::String` component
This commit is contained in:
Alan Guo Xiang Tan
2024-03-06 08:24:29 +08:00
committed by GitHub
parent 81ede05005
commit 94b09f3331
19 changed files with 689 additions and 648 deletions

View File

@@ -25,16 +25,25 @@
</div>
<div class="setting-value">
{{component
this.componentName
setting=this.setting
value=this.buffered.value
validationMessage=this.validationMessage
preview=this.preview
isSecret=this.isSecret
allowAny=this.allowAny
changeValueCallback=this.changeValueCallback
}}
{{#if this.settingEditButton}}
<DButton
@action={{this.settingEditButton.action}}
@icon={{this.settingEditButton.icon}}
@label={{this.settingEditButton.label}}
class="setting-value-edit-button"
/>
{{else}}
{{component
this.componentName
setting=this.setting
value=this.buffered.value
validationMessage=this.validationMessage
preview=this.preview
isSecret=this.isSecret
allowAny=this.allowAny
changeValueCallback=this.changeValueCallback
}}
{{/if}}
</div>
{{#if this.dirty}}

View File

@@ -1,11 +1,5 @@
{{#if this.setting.textarea}}
<Textarea @value={{this.value}} class="input-setting-textarea" />
{{else if this.setting.json_schema}}
<DButton
@action={{fn (mut this.showJsonEditorModal) true}}
@icon="pencil-alt"
@label="admin.site_settings.json_schema.edit"
/>
{{else if this.isSecret}}
<Input @type="password" @value={{this.value}} class="input-setting-string" />
{{else}}
@@ -13,14 +7,4 @@
{{/if}}
<SettingValidationMessage @message={{this.validationMessage}} />
<div class="desc">{{html-safe this.setting.description}}</div>
{{#if this.showJsonEditorModal}}
<Modal::JsonSchemaEditor
@updateValue={{fn (mut this.value)}}
@value={{this.value}}
@settingName={{this.setting.setting}}
@jsonSchema={{this.setting.json_schema}}
@closeModal={{fn (mut this.showJsonEditorModal) false}}
/>
{{/if}}
<div class="desc">{{html-safe this.setting.description}}</div>