Vorlage fuer eigene Ableger-Installationen: Website + CMS-Code
Bereinigt von Pilot-Spezifika (echte Inhalte, Erzbistum-Hamburg-Bezuege, Domain-Werte) - install.env und hugo.toml [params] mit generischen Platzhaltern. docs/ komplett entfernt: Konzept, Manifest, Installations- anleitungen leben jetzt auf der Projekt-Website statt redundant im Repo, README verweist dorthin. Decap-CMS-Version von einer floatenden ^3.0.0 auf ein festes 3.15.1 gepinnt.
This commit is contained in:
@@ -0,0 +1,256 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Ableger – Redaktion</title>
|
||||
<!-- Same stylesheet as the Hugo website (site-header/site-title/
|
||||
site-nav, color variables) - for our own header below, not for
|
||||
Decap's own UI (that's reskinned by the block below). -->
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
<style>
|
||||
/*
|
||||
Decap CMS doesn't ship theming via CSS variables; its class names
|
||||
are Emotion hashes that can change with every build. We therefore
|
||||
deliberately target structural partial class names (e.g.
|
||||
"ControlContainer") instead of exact hash classes - more stable
|
||||
against Decap version changes, even if not 100% future-proof.
|
||||
*/
|
||||
|
||||
/* Primary color for the active form field (label pill + input
|
||||
border). Set both background AND text color explicitly: for
|
||||
nested fields (e.g. in list entries) Decap never marks the label
|
||||
itself as "active" and therefore never automatically ships the
|
||||
white text along with it - without our own color, the text would
|
||||
stay dark gray and barely readable on teal. */
|
||||
[class*="ControlContainer"]:focus-within [class*="ControlTopbar"] label {
|
||||
background-color: var(--color-accent) !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
[class*="ControlContainer"] input:focus,
|
||||
[class*="ControlContainer"] textarea:focus,
|
||||
[class*="ControlContainer"] select:focus {
|
||||
border-color: var(--color-accent) !important;
|
||||
}
|
||||
|
||||
/* Group size (min/max) side by side instead of stacked */
|
||||
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
column-gap: 1rem;
|
||||
}
|
||||
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) > [class*="ControlContainer"] {
|
||||
width: 100%;
|
||||
}
|
||||
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) > [class*="ControlContainer"]:has(label[for^="gruppengroesse_min-field-"]),
|
||||
[class*="ControlPaneContainer"]:not([class*="PreviewPaneContainer"]) > [class*="ControlContainer"]:has(label[for^="gruppengroesse_max-field-"]) {
|
||||
width: calc(50% - 0.5rem);
|
||||
}
|
||||
|
||||
/* The publish button (edit page) and the sort button (overview) use
|
||||
the same button type. Depending on state (e.g. "Publish" vs.
|
||||
"Published", or "Sort by"), Decap ships different, sometimes very
|
||||
dark text colors that were meant for Decap's respective default
|
||||
background - not necessarily readable on our teal. Text color is
|
||||
therefore set uniformly to white for all states. */
|
||||
[class*="StyledDropdownButton"] {
|
||||
background-color: var(--color-accent) !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* Preview show/hide and auto-scroll icons to the right of the
|
||||
preview. The icons themselves use currentColor, so the text color
|
||||
is enough. */
|
||||
[class*="EditorToggle"] {
|
||||
color: var(--color-accent) !important;
|
||||
}
|
||||
|
||||
/* Rich text/markdown switch in the markdown field. Do not apply to
|
||||
boolean fields (e.g. "Veröffentlicht") - their class additionally
|
||||
contains "BooleanBackground" and needs visibly different colors
|
||||
for on/off, otherwise the state isn't recognizable. */
|
||||
[class*="ToggleBackground"]:not([class*="BooleanBackground"]) {
|
||||
background-color: var(--color-accent) !important;
|
||||
}
|
||||
|
||||
/* Header of the overview page (Contents / Media). "Contents" is a
|
||||
link (class additionally contains "AppHeaderNavLink"), "Media" on
|
||||
the other hand is a plain button without that addition -
|
||||
"AppHeaderButton" is the common denominator. */
|
||||
[class*="AppHeaderButton"] {
|
||||
color: var(--color-accent) !important;
|
||||
}
|
||||
|
||||
/* Global "Media" button hidden: it always uploads into the
|
||||
site-wide fallback folder (media_folder/public_folder above in
|
||||
config.yml), regardless of which method you're currently working
|
||||
on - useless for our workflow and potentially confusing. "Media"
|
||||
is the only match for AppHeaderButton without AppHeaderNavLink
|
||||
(checked, see comment above), so "Contents" stays untouched. */
|
||||
[class*="AppHeaderButton"]:not([class*="AppHeaderNavLink"]) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Sidebar (list of collections): text always in the primary color,
|
||||
the active entry additionally with a lighter primary surface
|
||||
instead of Decap blue. NOT via [class*="sidebarNavLinkActive"]:
|
||||
Emotion generates this substring as part of the base class name
|
||||
for EVERY instance of the component (active or not) - verified
|
||||
live via DOM inspection, both sidebar entries carried the same
|
||||
"...sidebarNavLinkActive..." class, making both look active. The
|
||||
actual difference is the aria-current attribute, which Decap only
|
||||
sets on the active entry. */
|
||||
[class*="SidebarNavLink"] {
|
||||
color: var(--color-accent) !important;
|
||||
}
|
||||
[class*="SidebarNavLink"][aria-current="page"] {
|
||||
background-color: color-mix(in srgb, var(--color-accent) 12%, transparent) !important;
|
||||
border-left: 2px solid var(--color-accent) !important;
|
||||
}
|
||||
|
||||
/*
|
||||
A dedicated header around Decap CMS (instead of an isolated page),
|
||||
so the editorial area feels like part of the same website, not a
|
||||
jump into a foreign tool. Decap mounts specifically into #nc-root
|
||||
for this instead of taking over the whole <body> - an officially
|
||||
supported mechanism, see
|
||||
https://decapcms.org/docs/custom-mounting/.
|
||||
|
||||
Known Decap bug (https://github.com/decaporg/decap-cms/issues/7197):
|
||||
the editor toolbar is internally "position: fixed" relative to the
|
||||
viewport, not to #nc-root - without a countermeasure it would slide
|
||||
over our own header instead of staying below it. Fix: "transform"
|
||||
on an ancestor of #nc-root creates a new containing block for
|
||||
"position: fixed" descendants (CSS spec, not a Decap-specific
|
||||
hack) - effectively makes Decap's toolbar relative to
|
||||
#nc-root-wrap instead of the real viewport. Verified locally.
|
||||
*/
|
||||
.nc-root-wrap {
|
||||
transform: translate(0, 0);
|
||||
min-height: calc(100vh - 3.75rem);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
<a class="site-title" href="/">
|
||||
<img src="/img/logo.svg" alt="" class="site-logo" width="32" height="32">
|
||||
<span id="site-title-text">Ableger</span>
|
||||
</a>
|
||||
<nav class="site-nav">
|
||||
<a href="/admin/status/">Status</a>
|
||||
<a href="/">← Zur Website</a>
|
||||
</nav>
|
||||
</header>
|
||||
<script src="/admin/site-meta.js" data-title-suffix=" – Redaktion"></script>
|
||||
<div class="nc-root-wrap">
|
||||
<div id="nc-root"></div>
|
||||
</div>
|
||||
<!-- Loads Decap CMS from a CDN; configuration is read automatically from ./config.yml.
|
||||
Pinned to an exact version, not a floating range like "^3.0.0" - a
|
||||
floating range would let Decap update itself silently on every page
|
||||
load, whereas an update should be a deliberate, tested step. See the
|
||||
dependency-update chapter on the project website for how to check
|
||||
for and apply updates. -->
|
||||
<script src="https://unpkg.com/decap-cms@3.15.1/dist/decap-cms.js"></script>
|
||||
<script>
|
||||
// Custom preview templates instead of Decap's generic markdown
|
||||
// rendering, so the preview looks like the real method/variant page
|
||||
// while editing - including the same CSS classes and therefore the
|
||||
// same dark-mode switching as the website itself (Decap CMS has no
|
||||
// dark mode of its own for this, see github.com/decaporg/
|
||||
// decap-cms/issues/3267, open since 2020 - but that only affects
|
||||
// Decap's own forms/sidebar, not this preview here).
|
||||
// API: https://decapcms.org/docs/customization/
|
||||
var h = window.h;
|
||||
var createClass = window.createClass;
|
||||
|
||||
function labelList(label, values) {
|
||||
if (!values || !values.size) return null;
|
||||
return h('div', {},
|
||||
h('p', { className: 'method__label' }, label),
|
||||
h('ul', {}, values.map(function (v, i) { return h('li', { key: i }, v); }).toArray())
|
||||
);
|
||||
}
|
||||
|
||||
function tagChips(values) {
|
||||
if (!values || !values.size) return null;
|
||||
return h('ul', { className: 'method__tags' },
|
||||
values.map(function (v, i) { return h('li', { key: i }, h('span', {}, v)); }).toArray()
|
||||
);
|
||||
}
|
||||
|
||||
var MethodePreview = createClass({
|
||||
render: function () {
|
||||
var data = this.props.entry.get('data');
|
||||
var zielgruppe = data.get('zielgruppe');
|
||||
var kompetenzbereich = data.get('kompetenzbereich');
|
||||
var kategorie = data.get('kategorie');
|
||||
|
||||
return h('div', { className: 'preview-wrap' },
|
||||
h('article', { className: 'method' },
|
||||
h('header', { className: 'method__header' },
|
||||
h('h1', {}, data.get('titel')),
|
||||
data.get('kurzbeschreibung') ? h('p', { className: 'method__lead' }, data.get('kurzbeschreibung')) : null
|
||||
),
|
||||
h('div', { className: 'method__section method__section--methode' },
|
||||
h('h2', {}, 'Steckbrief'),
|
||||
data.get('verwendungsmoeglichkeit') ? h('div', {},
|
||||
h('p', { className: 'method__label' }, 'Verwendungsmöglichkeit'),
|
||||
h('p', {}, data.get('verwendungsmoeglichkeit'))
|
||||
) : null,
|
||||
h('dl', { className: 'method__meta-inline' },
|
||||
zielgruppe && zielgruppe.size ? h('div', {}, h('dt', {}, 'Zielgruppe'), h('dd', {}, zielgruppe.join(', '))) : null,
|
||||
kompetenzbereich && kompetenzbereich.size ? h('div', {}, h('dt', {}, 'Kompetenzbereich'), h('dd', {}, kompetenzbereich.join(', '))) : null,
|
||||
kategorie && kategorie.size ? h('div', {}, h('dt', {}, 'Kategorie'), h('dd', {}, kategorie.join(', '))) : null
|
||||
),
|
||||
labelList('Lernchancen', data.get('lernchancen')),
|
||||
labelList('Herkunft', data.get('herkunft')),
|
||||
labelList('Initiator:innen', data.get('initiatoren')),
|
||||
tagChips(data.get('tags'))
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
var ExemplarPreview = createClass({
|
||||
render: function () {
|
||||
var data = this.props.entry.get('data');
|
||||
var dauer = data.get('dauer_minuten');
|
||||
var gmin = data.get('gruppengroesse_min');
|
||||
var gmax = data.get('gruppengroesse_max');
|
||||
|
||||
return h('div', { className: 'preview-wrap' },
|
||||
h('article', { className: 'method variant' },
|
||||
h('header', { className: 'method__header' },
|
||||
h('h1', {}, data.get('untertitel'))
|
||||
),
|
||||
h('section', { className: 'method__section' },
|
||||
h('h2', {}, 'Diese Variante'),
|
||||
data.get('varianten_beschreibung') ? h('p', { className: 'method__lead' }, data.get('varianten_beschreibung')) : null,
|
||||
h('dl', { className: 'method__meta-inline' },
|
||||
dauer != null ? h('div', {}, h('dt', {}, 'Dauer'), h('dd', {}, dauer + ' Minuten')) : null,
|
||||
(gmin != null || gmax != null) ? h('div', {}, h('dt', {}, 'Gruppengröße'), h('dd', {}, gmin === gmax ? gmin : gmin + '–' + gmax)) : null,
|
||||
data.get('lizenz') ? h('div', {}, h('dt', {}, 'Lizenz'), h('dd', {}, data.get('lizenz'))) : null
|
||||
),
|
||||
labelList('Material', data.get('material')),
|
||||
labelList('Autor:innen', data.get('autoren')),
|
||||
labelList('Quellen', data.get('quellen'))
|
||||
),
|
||||
h('div', { className: 'method__body' }, this.props.widgetFor('body'))
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
CMS.registerPreviewTemplate('methoden', MethodePreview);
|
||||
CMS.registerPreviewTemplate('varianten', ExemplarPreview);
|
||||
CMS.registerPreviewStyle('/css/style.css');
|
||||
// The website itself wraps .method with .site-main (max-width,
|
||||
// inner padding) - that's not in style.css (that's page layout, not
|
||||
// component style), so it's rebuilt separately here for the preview.
|
||||
CMS.registerPreviewStyle('.preview-wrap { max-width: 48rem; margin: 0 auto; padding: 1.5rem; }', { raw: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user