mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 19:26:04 +08:00
This commit removes the filter that would remove themeable site settings from all setting lists, so they are easier to find for admins. To do this, we show the value of the site's default theme for that theme site setting, disable the setting component, and provide a link to the site's default theme for quick editing. --------- Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
40 lines
1 KiB
Text
Vendored
40 lines
1 KiB
Text
Vendored
import Component from "@glimmer/component";
|
|
import { on } from "@ember/modifier";
|
|
import { action } from "@ember/object";
|
|
|
|
export default class SiteSettingsInteger extends Component {
|
|
@action
|
|
updateValue(event) {
|
|
const num = parseInt(event.target.value, 10);
|
|
|
|
if (isNaN(num)) {
|
|
return;
|
|
}
|
|
|
|
// Settings are stored as strings, this way the main site setting component
|
|
// doesn't get confused and think the value has changed from default if the
|
|
// admin sets it to the same number as the default.
|
|
this.args.changeValueCallback(num.toString());
|
|
}
|
|
|
|
@action
|
|
preventDecimal(event) {
|
|
if (event.key === "." || event.key === ",") {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
|
|
<template>
|
|
<input
|
|
{{on "keydown" this.preventDecimal}}
|
|
{{on "input" this.updateValue}}
|
|
type="number"
|
|
value={{@value}}
|
|
min={{if @setting.min @setting.min null}}
|
|
max={{if @setting.max @setting.max null}}
|
|
class="input-setting-integer"
|
|
step="1"
|
|
disabled={{@disabled}}
|
|
/>
|
|
</template>
|
|
}
|