mirror of
https://github.com/discourse/discourse.git
synced 2025-07-12 20:03:35 +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() {
|
startTrackingChanges() {
|
||||||
this.set("originals", { name: this.name });
|
this.set("originals", {
|
||||||
|
name: this.name,
|
||||||
|
user_selectable: this.user_selectable,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
schemeJson() {
|
schemeJson() {
|
||||||
@ -46,14 +49,22 @@ const ColorScheme = EmberObject.extend({
|
|||||||
return newScheme;
|
return newScheme;
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("name", "colors.@each.changed", "saving")
|
@discourseComputed(
|
||||||
changed(name) {
|
"name",
|
||||||
|
"user_selectable",
|
||||||
|
"colors.@each.changed",
|
||||||
|
"saving"
|
||||||
|
)
|
||||||
|
changed(name, user_selectable) {
|
||||||
if (!this.originals) {
|
if (!this.originals) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.originals.name !== name) {
|
if (this.originals.name !== name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (this.originals.user_selectable !== user_selectable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (this.colors.any((c) => c.get("changed"))) {
|
if (this.colors.any((c) => c.get("changed"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -80,9 +91,9 @@ const ColorScheme = EmberObject.extend({
|
|||||||
this.setProperties({ savingStatus: I18n.t("saving"), saving: true });
|
this.setProperties({ savingStatus: I18n.t("saving"), saving: true });
|
||||||
|
|
||||||
const data = {};
|
const data = {};
|
||||||
|
|
||||||
if (!opts || !opts.enabledOnly) {
|
if (!opts || !opts.enabledOnly) {
|
||||||
data.name = this.name;
|
data.name = this.name;
|
||||||
|
data.user_selectable = this.user_selectable;
|
||||||
data.base_scheme_id = this.base_scheme_id;
|
data.base_scheme_id = this.base_scheme_id;
|
||||||
data.colors = [];
|
data.colors = [];
|
||||||
this.colors.forEach((c) => {
|
this.colors.forEach((c) => {
|
||||||
|
@ -41,7 +41,14 @@
|
|||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="admin-controls">
|
<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>
|
</div>
|
||||||
|
|
||||||
{{#if colors.length}}
|
{{#if colors.length}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user