mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 22:04:02 +08:00
a92cf019db
This commit fixes a number of bugs in `file_size_restriction` settings and does a little of refactoring to reduce duplicated code in site setting types (the refactoring is necessary to fix one of the bugs). The bugs in `file_size_restriction` settings that are fixed in this commit: 1. Save/cancel buttons next to a `file_size_restriction` setting are shown upon navigating to the settings page without changes being made to the setting 2. Cancel button that discards changes made to the setting doesn't work 3. Reset button that resets the setting to its default doesn't work 4. Validation error message isn't cleared when resetting/cancelling changes To repro those bugs, navigate to `/admin/site_settings/category/files` and observe the top 2 settings in the page (`max image size kb` and `max attachment size kb`). Internal topic: t/134726.
84 lines
2.1 KiB
Handlebars
84 lines
2.1 KiB
Handlebars
<div class="setting-label">
|
|
<h3>
|
|
{{this.settingName}}
|
|
|
|
{{#if this.staffLogFilter}}
|
|
<LinkTo
|
|
@route="adminLogs.staffActionLogs"
|
|
@query={{hash filters=this.staffLogFilter force_refresh=true}}
|
|
title={{i18n "admin.settings.history"}}
|
|
>
|
|
<span class="history-icon">
|
|
{{d-icon "history"}}
|
|
</span>
|
|
</LinkTo>
|
|
{{/if}}
|
|
</h3>
|
|
|
|
{{#if this.defaultIsAvailable}}
|
|
<DButton
|
|
class="btn-link"
|
|
@action={{this.setDefaultValues}}
|
|
@translatedLabel={{this.setting.setDefaultValuesLabel}}
|
|
/>
|
|
{{/if}}
|
|
</div>
|
|
|
|
<div class="setting-value">
|
|
{{#if this.settingEditButton}}
|
|
<DButton
|
|
@action={{this.settingEditButton.action}}
|
|
@icon={{this.settingEditButton.icon}}
|
|
@label={{this.settingEditButton.label}}
|
|
class="setting-value-edit-button"
|
|
/>
|
|
|
|
<SiteSettings::Description @description={{this.setting.description}} />
|
|
{{else}}
|
|
{{component
|
|
this.componentName
|
|
setting=this.setting
|
|
value=this.buffered.value
|
|
preview=this.preview
|
|
isSecret=this.isSecret
|
|
allowAny=this.allowAny
|
|
changeValueCallback=this.changeValueCallback
|
|
setValidationMessage=this.setValidationMessage
|
|
}}
|
|
<SettingValidationMessage @message={{this.validationMessage}} />
|
|
{{#if this.displayDescription}}
|
|
<SiteSettings::Description @description={{this.setting.description}} />
|
|
{{/if}}
|
|
{{/if}}
|
|
</div>
|
|
|
|
{{#if this.dirty}}
|
|
<div class="setting-controls">
|
|
<DButton
|
|
@action={{this.update}}
|
|
@icon="check"
|
|
@disabled={{this.disableSaveButton}}
|
|
class="ok setting-controls__ok"
|
|
/>
|
|
<DButton
|
|
@action={{this.cancel}}
|
|
@icon="times"
|
|
class="cancel setting-controls__cancel"
|
|
/>
|
|
</div>
|
|
{{else if this.overridden}}
|
|
{{#if this.setting.secret}}
|
|
<DButton
|
|
@action={{this.toggleSecret}}
|
|
@icon="far-eye-slash"
|
|
class="setting-toggle-secret"
|
|
/>
|
|
{{/if}}
|
|
|
|
<DButton
|
|
class="btn-default undo setting-controls__undo"
|
|
@action={{this.resetDefault}}
|
|
@icon="undo"
|
|
@label="admin.settings.reset"
|
|
/>
|
|
{{/if}} |