UX: Tweaks to admin color palette dropdown (#10502)
This commit is contained in:
parent
f51ccea028
commit
8b2c4b07a4
|
@ -10,11 +10,22 @@ export default SelectKitRowComponent.extend({
|
|||
|
||||
palettes: computed("item.colors.[]", function() {
|
||||
return (this.item.colors || [])
|
||||
.filter(color => color.name !== "secondary")
|
||||
.map(color => `#${escapeExpression(color.hex)}`)
|
||||
.map(
|
||||
hex => `<span class="palette" style="background-color:${hex}"></span>`
|
||||
)
|
||||
.join("")
|
||||
.htmlSafe();
|
||||
}),
|
||||
|
||||
backgroundColor: computed("item.colors.[]", function() {
|
||||
const secondary = (this.item.colors || []).findBy("name", "secondary");
|
||||
|
||||
if (secondary && secondary.hex) {
|
||||
return `background-color:#${escapeExpression(secondary.hex)}`.htmlSafe();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
</span>
|
||||
|
||||
{{#if item.colors}}
|
||||
<div class="palettes">
|
||||
<div class="palettes" style={{backgroundColor}}>
|
||||
{{palettes}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
align-items: center;
|
||||
margin-left: 0.5em;
|
||||
flex: 1 0 0;
|
||||
padding: 8px;
|
||||
|
||||
.palette {
|
||||
height: 15px;
|
||||
|
|
|
@ -135,8 +135,6 @@ class Admin::ThemesController < Admin::AdminController
|
|||
theme_fields: :upload
|
||||
)
|
||||
@color_schemes = ColorScheme.all.includes(:theme, color_scheme_colors: :color_scheme).to_a
|
||||
light = ColorScheme.new(name: I18n.t("color_schemes.light_default"))
|
||||
@color_schemes.unshift(light)
|
||||
|
||||
payload = {
|
||||
themes: ActiveModel::ArraySerializer.new(@themes, each_serializer: ThemeSerializer),
|
||||
|
|
|
@ -3874,7 +3874,6 @@ en:
|
|||
color_schemes:
|
||||
base_theme_name: "Base"
|
||||
light: "Light"
|
||||
light_default: "Light (default)"
|
||||
dark: "Dark"
|
||||
neutral: "Neutral"
|
||||
grey_amber: "Grey Amber"
|
||||
|
|
|
@ -252,7 +252,7 @@ describe Admin::ThemesController do
|
|||
|
||||
json = response.parsed_body
|
||||
|
||||
expect(json["extras"]["color_schemes"].length).to eq(2)
|
||||
expect(json["extras"]["color_schemes"].length).to eq(1)
|
||||
theme_json = json["themes"].find { |t| t["id"] == theme.id }
|
||||
expect(theme_json["theme_fields"].length).to eq(2)
|
||||
expect(theme_json["remote_theme"]["remote_version"]).to eq("7")
|
||||
|
|
Loading…
Reference in New Issue