Fix categoryColor for /categories view

And accept both categoryColor and categoryColour as special params.
This commit is contained in:
Penar Musaraj 2020-09-28 10:41:15 -04:00
parent b59c961f0a
commit 4c83914e87
No known key found for this signature in database
GPG Key ID: E390435D881FF0F7
2 changed files with 7 additions and 3 deletions

View File

@ -108,7 +108,7 @@ export default {
let iconItem = getIconItem(category.slug); let iconItem = getIconItem(category.slug);
if (iconItem) { if (iconItem) {
let itemColor = iconItem[2] let itemColor = iconItem[2]
? iconItem[2] == "categoryColour" ? iconItem[2].match(/categoryColo(u*)r/)
? `style="color: #${color}"` ? `style="color: #${color}"`
: `style="color: ${iconItem[2]}"` : `style="color: ${iconItem[2]}"`
: ""; : "";
@ -154,7 +154,11 @@ export default {
html(attrs) { html(attrs) {
let iconItem = getIconItem(attrs.category.slug); let iconItem = getIconItem(attrs.category.slug);
if (iconItem) { if (iconItem) {
let itemColor = iconItem[2] ? `color: ${iconItem[2]}` : ""; let itemColor = iconItem[2]
? iconItem[2].match(/categoryColo(u*)r/g)
? `color: #${attrs.category.color}`
: `color: ${iconItem[2]}`
: "";
let itemIcon = iconItem[1] != "" ? iconNode(iconItem[1]) : ""; let itemIcon = iconItem[1] != "" ? iconNode(iconItem[1]) : "";
return h("span.category-icon", { style: itemColor }, itemIcon); return h("span.category-icon", { style: itemColor }, itemIcon);
} }

View File

@ -2,7 +2,7 @@ category_icon_list:
default: "help,question-circle,#CC0000,partial|" default: "help,question-circle,#CC0000,partial|"
type: "list" type: "list"
list_type: "simple" list_type: "simple"
description: 'Enter comma-delimited configuration for categories, in the format "slug,icon,colour,match". Colour in format #123456 or "categoryColour" to use the default colour for the category (same as the Badge colour). If match is "partial" then the slug need only partially match the category-slug, otherwise an exact match is required' description: 'Enter comma-delimited configuration for categories, in the format "slug,icon,color,match". Colour in format #123456 or "categoryColor" to use the default color for the category (same as the Badge color). If match is "partial" then the slug need only partially match the category-slug, otherwise an exact match is required'
svg_icons: svg_icons:
default: "question-circle" default: "question-circle"
type: "list" type: "list"