mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00:00
UX: Fix confusing admin UI for color scheme updates (#11100)
This commit is contained in:
parent
f5a726e52b
commit
5041ebe612
@ -20,7 +20,10 @@ const ColorScheme = EmberObject.extend({
|
||||
},
|
||||
|
||||
startTrackingChanges() {
|
||||
this.set("originals", { name: this.name });
|
||||
this.set("originals", {
|
||||
name: this.name,
|
||||
user_selectable: this.user_selectable,
|
||||
});
|
||||
},
|
||||
|
||||
schemeJson() {
|
||||
@ -46,14 +49,22 @@ const ColorScheme = EmberObject.extend({
|
||||
return newScheme;
|
||||
},
|
||||
|
||||
@discourseComputed("name", "colors.@each.changed", "saving")
|
||||
changed(name) {
|
||||
@discourseComputed(
|
||||
"name",
|
||||
"user_selectable",
|
||||
"colors.@each.changed",
|
||||
"saving"
|
||||
)
|
||||
changed(name, user_selectable) {
|
||||
if (!this.originals) {
|
||||
return false;
|
||||
}
|
||||
if (this.originals.name !== name) {
|
||||
return true;
|
||||
}
|
||||
if (this.originals.user_selectable !== user_selectable) {
|
||||
return true;
|
||||
}
|
||||
if (this.colors.any((c) => c.get("changed"))) {
|
||||
return true;
|
||||
}
|
||||
@ -80,9 +91,9 @@ const ColorScheme = EmberObject.extend({
|
||||
this.setProperties({ savingStatus: I18n.t("saving"), saving: true });
|
||||
|
||||
const data = {};
|
||||
|
||||
if (!opts || !opts.enabledOnly) {
|
||||
data.name = this.name;
|
||||
data.user_selectable = this.user_selectable;
|
||||
data.base_scheme_id = this.base_scheme_id;
|
||||
data.colors = [];
|
||||
this.colors.forEach((c) => {
|
||||
|
@ -41,7 +41,14 @@
|
||||
<br>
|
||||
|
||||
<div class="admin-controls">
|
||||
{{inline-edit-checkbox action=(action "applyUserSelectable") labelKey="admin.customize.theme.color_scheme_user_selectable" checked=model.user_selectable}}
|
||||
{{#if model.theme_id}}
|
||||
{{inline-edit-checkbox action=(action "applyUserSelectable") labelKey="admin.customize.theme.color_scheme_user_selectable" checked=model.user_selectable}}
|
||||
{{else}}
|
||||
<label>
|
||||
{{input type="checkbox" checked=model.user_selectable}}
|
||||
{{i18n "admin.customize.theme.color_scheme_user_selectable"}}
|
||||
</label>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#if colors.length}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user