FEATURE: color-palettes component (#6992)

This commit is contained in:
Joffrey JAFFEUX
2019-02-08 14:01:14 +01:00
committed by GitHub
parent babd80dfd1
commit 44d9bc12c9
6 changed files with 63 additions and 7 deletions
@@ -67,13 +67,13 @@
<code>{{model.remoteError}}</code>
</div>
{{/if}}
{{#if model.remote_theme.commits_behind}}
{{#d-button action=(action "updateToLatest") icon="download" class='btn-primary'}}{{i18n "admin.customize.theme.update_to_latest"}}{{/d-button}}
{{else}}
{{#d-button action=(action "checkForThemeUpdates") icon="refresh" class="btn-default"}}{{i18n "admin.customize.theme.check_for_updates"}}{{/d-button}}
{{/if}}
<span class='status-message'>
{{#if updatingRemote}}
{{i18n 'admin.customize.theme.updating'}}
@@ -104,11 +104,14 @@
<div class="control-unit">
<div class="mini-title">{{i18n "admin.customize.theme.color_scheme"}}</div>
<div class="description">{{i18n "admin.customize.theme.color_scheme_select"}}</div>
<div class="control">{{combo-box content=colorSchemes
filterable=true
forceEscape=true
value=colorSchemeId
icon="paint-brush"}}
<div class="control">
{{color-palettes
content=colorSchemes
filterable=true
forceEscape=true
value=colorSchemeId
icon="paint-brush"}}
{{#if colorSchemeChanged}}
{{d-button action=(action "changeScheme") class="btn-primary submit-edit" icon="check"}}
{{d-button action=(action "cancelChangeScheme") class="btn-default cancel-edit" icon="times"}}
@@ -0,0 +1,7 @@
import ComboBoxComponent from "select-kit/components/combo-box";
export default ComboBoxComponent.extend({
pluginApiIdentifiers: ["color-palettes"],
classNames: "color-palettes",
rowComponent: "color-palettes/color-palettes-row"
});
@@ -0,0 +1,14 @@
import { escapeExpression } from "discourse/lib/utilities";
import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
import { default as computed } from "ember-addons/ember-computed-decorators";
export default SelectKitRowComponent.extend({
layoutName:
"select-kit/templates/components/color-palettes/color-palettes-row",
classNames: "color-palettes-row",
@computed("computedContent.originalContent.colors")
colors(colors) {
return (colors || []).map(color => `#${escapeExpression(color.hex)}`);
}
});
@@ -0,0 +1,11 @@
<span class="name">
{{label}}
</span>
{{#if colors}}
<div class="palettes">
{{#each colors as |color|}}
<span class="palette" style="background-color:{{color}};"></span>
{{/each}}
</div>
{{/if}}