105 lines
3.1 KiB
YAML
105 lines
3.1 KiB
YAML
########################################################################
|
|
# Tags — verwaltete Schlagwörter für Mediathek und andere Collections
|
|
########################################################################
|
|
|
|
name: tag
|
|
meta:
|
|
label: { de: "Schlagwörter", en: "Tags" }
|
|
muiIcon: label
|
|
group: content
|
|
imageUrl: "https://images.unsplash.com/photo-1571907483086-3c0ea40cc16d?auto=format&fit=crop&q=80&w=800"
|
|
preview:
|
|
select: [name, color]
|
|
label: name
|
|
labelStyle:
|
|
eval: |
|
|
//js
|
|
(function() {
|
|
const raw = ($this?.color || '').trim()
|
|
if (!raw) return ''
|
|
|
|
const hex = raw.replace(/^#/, '')
|
|
if (!/^[0-9a-fA-F]{6}$/.test(hex)) {
|
|
return 'background:' + raw + ';color:#F9FAFB;border:1px solid ' + raw
|
|
}
|
|
|
|
const r = parseInt(hex.slice(0, 2), 16)
|
|
const g = parseInt(hex.slice(2, 4), 16)
|
|
const b = parseInt(hex.slice(4, 6), 16)
|
|
|
|
const toLinear = (channel) => {
|
|
const normalized = channel / 255
|
|
return normalized <= 0.04045
|
|
? normalized / 12.92
|
|
: Math.pow((normalized + 0.055) / 1.055, 2.4)
|
|
}
|
|
|
|
const luminance = (
|
|
0.2126 * toLinear(r) +
|
|
0.7152 * toLinear(g) +
|
|
0.0722 * toLinear(b)
|
|
)
|
|
const whiteContrast = 1.05 / (luminance + 0.05)
|
|
const darkContrast = (luminance + 0.05) / 0.05
|
|
const text = darkContrast >= whiteContrast ? '#111827' : '#F9FAFB'
|
|
const border = luminance > 0.85 ? '#D1D5DB' : raw
|
|
|
|
return 'background:' + raw + ';color:' + text + ';border:1px solid ' + border
|
|
})()
|
|
//!js
|
|
|
|
permissions:
|
|
public:
|
|
methods:
|
|
get: true
|
|
user:
|
|
methods:
|
|
get: true
|
|
post: true
|
|
put: true
|
|
delete: true
|
|
"token:${ADMIN_TOKEN}":
|
|
methods:
|
|
get: true
|
|
post: true
|
|
put: true
|
|
delete: true
|
|
|
|
fields:
|
|
- name: name
|
|
type: string
|
|
meta:
|
|
label: { de: "Name", en: "Name" }
|
|
- name: group
|
|
type: string
|
|
meta:
|
|
label: { de: "Gruppe", en: "Group" }
|
|
widget: select
|
|
choices:
|
|
- id: system
|
|
name: { de: "System", en: "System" }
|
|
- id: kategorie
|
|
name: { de: "Kategorie", en: "Category" }
|
|
- name: color
|
|
type: string
|
|
meta:
|
|
label: { de: "Farbe", en: "Color" }
|
|
widget: select
|
|
choices:
|
|
- id: "#4caf50"
|
|
name: { de: "Grün", en: "Green" }
|
|
badgeStyle: { backgroundColor: "#4caf50", color: "#ffffff" }
|
|
- id: "#2196f3"
|
|
name: { de: "Blau", en: "Blue" }
|
|
badgeStyle: { backgroundColor: "#2196f3", color: "#ffffff" }
|
|
- id: "#f44336"
|
|
name: { de: "Rot", en: "Red" }
|
|
badgeStyle: { backgroundColor: "#f44336", color: "#ffffff" }
|
|
- id: "#9c27b0"
|
|
name: { de: "Lila", en: "Purple" }
|
|
badgeStyle: { backgroundColor: "#9c27b0", color: "#ffffff" }
|
|
- name: _testdata
|
|
type: boolean
|
|
meta:
|
|
hide: true
|