mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: User selectable color schemes (#10544)
This commit is contained in:
@@ -72,6 +72,10 @@ export default Controller.extend({
|
||||
this.model.save();
|
||||
},
|
||||
|
||||
applyUserSelectable() {
|
||||
this.model.updateUserSelectable(this.get("model.user_selectable"));
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
const model = this.model;
|
||||
return bootbox.confirm(
|
||||
|
||||
@@ -107,6 +107,17 @@ const ColorScheme = EmberObject.extend({
|
||||
});
|
||||
},
|
||||
|
||||
updateUserSelectable(value) {
|
||||
if (!this.id) return;
|
||||
|
||||
return ajax(`/admin/color_schemes/${this.id}.json`, {
|
||||
data: JSON.stringify({ color_scheme: { user_selectable: value } }),
|
||||
type: "PUT",
|
||||
dataType: "json",
|
||||
contentType: "application/json"
|
||||
});
|
||||
},
|
||||
|
||||
destroy() {
|
||||
if (this.id) {
|
||||
return ajax(`/admin/color_schemes/${this.id}`, { type: "DELETE" });
|
||||
@@ -129,6 +140,7 @@ ColorScheme.reopenClass({
|
||||
theme_id: colorScheme.theme_id,
|
||||
theme_name: colorScheme.theme_name,
|
||||
base_scheme_id: colorScheme.base_scheme_id,
|
||||
user_selectable: colorScheme.user_selectable,
|
||||
colors: colorScheme.colors.map(c => {
|
||||
return ColorSchemeColor.create({
|
||||
name: c.name,
|
||||
|
||||
@@ -22,9 +22,12 @@
|
||||
icon="far-clipboard"
|
||||
label="admin.customize.copy_to_clipboard"
|
||||
}}
|
||||
<span class="saving {{unless model.savingStatus "hidden"}}">{{model.savingStatus}}</span>
|
||||
{{#if model.theme_id}}
|
||||
{{i18n "admin.customize.theme_owner"}}
|
||||
{{#link-to "adminCustomizeThemes.show" model.theme_id}}{{model.theme_name}}{{/link-to}}
|
||||
<span class="not-editable">
|
||||
{{i18n "admin.customize.theme_owner"}}
|
||||
{{#link-to "adminCustomizeThemes.show" model.theme_id}}{{model.theme_name}}{{/link-to}}
|
||||
</span>
|
||||
{{else}}
|
||||
{{d-button
|
||||
action=(action "destroy")
|
||||
@@ -33,27 +36,29 @@
|
||||
label="admin.customize.delete"
|
||||
}}
|
||||
{{/if}}
|
||||
<span class="saving {{unless model.savingStatus "hidden"}}">{{model.savingStatus}}</span>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="admin-controls">
|
||||
<div class="search controls">
|
||||
<label>
|
||||
{{input type="checkbox" checked=onlyOverridden}}
|
||||
{{i18n "admin.settings.show_overriden"}}
|
||||
</label>
|
||||
</div>
|
||||
{{inline-edit-checkbox action=(action "applyUserSelectable") labelKey="admin.customize.theme.color_scheme_user_selectable" checked=model.user_selectable}}
|
||||
</div>
|
||||
|
||||
{{#if colors.length}}
|
||||
<table class="table colors">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>
|
||||
</th>
|
||||
<th class="hex">{{i18n "admin.customize.color"}}</th>
|
||||
<th></th>
|
||||
<th class="overriden">
|
||||
{{#unless model.theme_id}}
|
||||
<label>
|
||||
{{input type="checkbox" checked=onlyOverridden}}
|
||||
{{i18n "admin.settings.show_overriden"}}
|
||||
</label>
|
||||
{{/unless}}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user