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:
2026-08-23 14:37:54 +02:00
commit 5e9da58d23
65 changed files with 5073 additions and 0 deletions
+378
View File
@@ -0,0 +1,378 @@
# admin/config.template.yml
# Template for the Decap CMS starting configuration. NOT served directly:
# scripts/generate-config.sh builds admin/config.yml from it (generated,
# not versioned, see .gitignore) - two independent substitution steps:
# (1) fields between "# VOKABULAR:<field>:START/END" markers are replaced
# if a matching entry exists in the content repo under _content/ableger.yml
# (key "vokabular") (a closed selection list instead of free text) - if the
# entry is missing, the block entered here stays unchanged. (2)
# "{{VARIABLE}}" placeholders (see backend/site_url below) are always
# replaced by the like-named values from install.env.
# Details: the Manifest chapter on the project website Teil C, vokabular/README.md.
# Deliberately separate from the website/CMS code repo (ableger_demo/ableger):
# dedicated access rights for method content instead of full access to the
# whole repo via CMS access. Details: the concept chapter on the project website Abschnitt 4 and 9.
# repo/app_id/api_root/base_url/auth_endpoint come from install.env
# (adjust centrally there for a fork), not directly here.
backend:
name: gitea
repo: "{{METHODEN_REPO}}"
app_id: "{{OAUTH_CLIENT_ID}}"
api_root: "https://{{GITEA_DOMAIN}}/api/v1"
base_url: "https://{{GITEA_DOMAIN}}"
auth_endpoint: "https://{{GITEA_DOMAIN}}/login/oauth/authorize"
branch: main
# For the "Preview" link in the editor toolbar (not in the list overview -
# per Decap's own docs, that only shows on the edit page).
# WEBSITE_DOMAIN comes from install.env, must match baseURL in hugo/hugo.toml.
site_url: "https://{{WEBSITE_DOMAIN}}"
# editorial_workflow (branch + PR per submission) would be the actually
# intended model, but is not supported by the Gitea backend in Decap CMS
# (runtime error on load): https://github.com/decaporg/decap-cms/issues/7115
# (open, no workaround). Hence simple: a direct commit for anyone with CMS
# access. Who gets access is a process question outside this config - see
# the concept chapter on the project website Abschnitt 5.
publish_mode: simple
# Fallback for media without their own field-level media_folder (among
# others the global "Media" button in the navigation) - now points into the
# content repo (ableger_demo/ableger_methoden) instead of the website repo,
# see backend.repo above.
media_folder: "_assets"
public_folder: "/_assets"
# Strip umlauts/accents from generated slugs: for the existence check Decap
# runs before every save (GET .../git/trees/main:<path>), Gitea returns a
# 400 error ("sha not found") for a path with non-ASCII characters - and
# that's true even when the path exists, not only for new entries. Verified
# live against the real Gitea API (ableger_methoden, main). Affects not
# only creation but every subsequent save of an existing entry with an
# umlaut in the folder name. Since this is a quirk of Gitea's extended-SHA
# resolution (not a Decap bug), it can't be fixed in this repo's code -
# only worked around via ASCII-clean slugs.
slug:
clean_accents: true
collections:
- name: "methoden"
label: "Methoden"
# Deliberately "methoden" instead of repo root ("") - Decap CMS crashes
# on an empty folder value (config processing sets collection.type only
# inside "if (folder) {...}", an empty string is falsy). Reproduced and
# verified locally, see the ableger_methoden commit "Methoden in
# methoden/-Unterordner verschieben".
folder: "methoden"
create: true
# Slug comes from the dedicated field "kennung", no longer from the
# title (Decap's default {{slug}}): the title may change at any time
# without moving the folder - see the "kennung" field below and
# the Manifest chapter on the project website, section "Bezeichner". Previously {{slug}} (derived
# from titel) - a title change demonstrably deleted the method page
# live and orphaned both variants, see the project website (background/analysis notes),
# Befund A.
slug: "{{fields.kennung}}"
path: "{{slug}}/index"
# {{slug}} in preview_path here (unlike slug: above) means the full
# path compiled from path: "{{slug}}/index", including "index" - would
# result in "beispiel-methode-index" instead of "beispiel-methode".
# {{dirname}} is the parent folder relative to the collection folder,
# which matches the slug exactly. Verified locally.
preview_path: "{{dirname}}"
identifier_field: "titel"
# Last-modified info in the overview, analogous to the variants
# collection below - {{commit_date}}/{{commit_author}} are Decap's own
# tokens fed from the Gitea API (checked live, also work in the summary
# template, not just in sortable_fields).
summary: "{{fields.titel}} | {{commit_date | date('D.M.YY')}} {{commit_author}}"
# Consistent vocabulary/order with the variants collection below:
# "Methode" instead of "Titel" as the label, "Zuletzt geändert am/durch"
# instead of Decap's default labels "Updated On"/"Author" - "Author"
# would be easily confused here with our own "Autor:innen" field (on
# variants), but actually means the commit author.
sortable_fields:
- { field: "titel", label: "Methode" }
- { field: "commit_date", label: "Zuletzt geändert am" }
- { field: "commit_author", label: "Zuletzt geändert durch" }
format: "frontmatter"
media_folder: ""
public_folder: ""
# Deliberately no draft field of its own here: publication is derived
# from the variants (see their "veroeffentlicht" field below) - as soon
# as at least one variant is published, the method is too.
# scripts/compute-methoden-sichtbarkeit.rb sets draft: true
# automatically for that, before every Hugo build, in the local
# _content copy (not in the repo), for every method without a
# published variant - Hugo's own, reliable draft mechanism then takes
# care of the rest (e.g. automatic exclusion from the
# homepage/search/taxonomies, not just the detail page). Details:
# the concept chapter on the project website Abschnitt 5.
#
# Equally deliberately no duration/group-size fields here: these depend
# on the respective variant (different versions of a method can take
# different amounts of time or be meant for different group sizes),
# hence they sit on the variant (see below) and are aggregated into a
# range for the method page from all its variants (see
# hugo/layouts/partials/variantenspanne.html).
#
# Equally deliberately no material field here (since August 2026,
# before that there was one): different variants of the same method
# often need different material - unlike duration/group size, there is
# also no aggregated display for this on the method page, since a
# material list as a union set would be misleading (could suggest you
# need everything together). Lives exclusively on the respective
# variant.
#
# License also on the variant, not here: what's copyrightable is not
# the method as an idea but the concrete description/write-up - which
# has lived entirely there since variants were introduced. The method
# page instead shows the set of licenses present across all variants
# (analogous to the duration range, see partials/variantenspanne.html).
fields:
# Stable identifier - becomes the folder name (see slug above) and
# thereby the target of every variant reference (see their "methode"
# field below). Assigned once, never changed afterward - the title
# may change freely, this may not. No technical lock in the editor
# possible (Decap has no readonly field), the validation script
# (scripts/validate.rb) flags later changes as an error. pattern
# also enforces ASCII-clean folder names directly in the form,
# rather than only via slug.clean_accents.
- label: "Kennung"
name: "kennung"
widget: "string"
hint: "Kurz und selbsterklärend. Kleinbuchstaben/Ziffern/Bindestriche/Unterstriche. Wird zum Ordnernamen und eindeutigen Identifier. Nach dem Anlegen nicht mehr ändern."
pattern: ["^[a-z0-9_]+(-[a-z0-9_]+)*$", "Nur Kleinbuchstaben, Ziffern, Unterstriche und Bindestriche, kein Bindestrich am Anfang/Ende"]
- { label: "Titel", name: "titel", widget: "string" }
- { label: "Kurzbeschreibung", name: "kurzbeschreibung", widget: "text", hint: "Kurze Zusammenfassung von Ziel und Ablauf, für den schnellen Überblick bei der Suche" }
- { label: "Verwendungsmöglichkeit", name: "verwendungsmoeglichkeit", widget: "text", hint: "Wann und wofür eignet sich die Methode?" }
# VOKABULAR:zielgruppe:START
- label: "Zielgruppe"
name: "zielgruppe"
widget: "select"
multiple: true
options:
- "Kinder"
- "Jugendliche"
- "Erwachsene"
- "Senior_innen"
# VOKABULAR:zielgruppe:END
- label: "Kompetenzbereich"
name: "kompetenzbereich"
widget: "select"
multiple: true
hint: "Kompetenzmodell nach Leipold, Kopf & Seidl (2010)"
options:
- "Fachkompetenz"
- "Methodenkompetenz"
- "Sozialkompetenz"
- "Selbstkompetenz"
# VOKABULAR:kategorie:START
- label: "Kategorie"
name: "kategorie"
widget: "list"
hint: "Frei wählbar, z. B. Advent, Firmvorbereitung, Kennenlernen, Konfliktbearbeitung – bewusst kein festes Vokabular"
# VOKABULAR:kategorie:END
- label: "Lernchancen"
name: "lernchancen"
widget: "list"
hint: "Stichsätze zu den (Lern-)Chancen, die mit der Methode verbunden werden"
summary: "{{fields.eintrag}}"
field: { label: "Lernchance", name: "eintrag", widget: "string" }
- label: "Herkunft"
name: "herkunft"
widget: "list"
required: false
hint: "Woher stammt die Methode ursprünglich? (Eigenentwicklung, Vorlage, Tradition o. Ä.) - wovon sich eine einzelne Variante ableitet, steht bei dieser selbst, siehe Collection \"Varianten\", Feld \"Quellen\"."
summary: "{{fields.eintrag}}"
field: { label: "Angabe", name: "eintrag", widget: "string" }
- label: "Initiator:innen"
name: "initiatoren"
widget: "list"
hint: "Wer die Methode ursprünglich entwickelt/eingebracht hat. Autor:innen einzelner Varianten stehen bei der jeweiligen Variante, siehe Collection \"Varianten\"."
summary: "{{fields.eintrag}}"
field: { label: "Initiator:in", name: "eintrag", widget: "string" }
# VOKABULAR:tags:START
- { label: "Tags", name: "tags", widget: "list", required: false }
# VOKABULAR:tags:END
# Every method has at least one variant - no special case for "just one
# version" in the data model, otherwise adding a second variant would
# require a later migration (moving content out of the method into a
# first variant). A method without a variant is deliberately not
# intended, but not technically enforced by the CMS (no access to other
# collections while saving). Linked via a relation field instead of
# nested files in the method folder: whether Decap's path template can
# include the folder of a method referenced via relation is unclear/
# unverified - the link instead happens only in Hugo (see
# hugo/layouts/_default/single.html), similar to a taxonomy.
#
# Own page bundle per variant (like methods), so that attachments - which
# belong to the respective variant, not the method, see the
# untertitel/varianten_beschreibung rationale above - have a fixed
# location where embedded images in the content (![]()) also resolve
# correctly via Hugo page resources. With only one variant, attachments
# stay functionally identical to the previous state (directly in the
# bundle folder of the - then only - variant, no dedicated src
# subfolder, same reason as for methods).
- name: "varianten"
label: "Varianten"
folder: "varianten"
create: true
# methode resolves via value_field (see relation field below) to the
# method's kennung, no longer to its title - title changes therefore no
# longer move variant folders, see the Manifest chapter on the project website and
# the project website (background/analysis notes), Befund A/E.
slug: "{{fields.methode}}--{{fields.kennung}}"
path: "{{slug}}/index"
# {{slug}} in preview_path here (as already with methods) means the
# full path compiled from path: "{{slug}}/index", including "index".
# {{dirname}} is the parent folder relative to the collection folder,
# which matches the slug exactly AND the real live URL: variants do
# live in Hugo's content structure under the "varianten" section (see
# hugo/hugo.toml module.mounts), but via the [permalinks] override
# there without a "varianten/" prefix in the URL - the section is kept
# for the template logic (where site.RegularPages "Section"
# "varianten"), only the URL becomes flat. Slug collisions with methods
# are ruled out, since variant slugs are always
# "<methode-kennung>--<varianten-kennung>", and method slugs never
# contain "--".
preview_path: "{{dirname}}"
identifier_field: "untertitel"
# Without this line, the overview would only show the subtitle (e.g.
# "Kurzform") with no recognizable relation to the method - no longer
# distinguishable with several methods that have similar variant names.
# "Show variants on the method edit page" would be the more obvious
# solution, but Decap CMS doesn't support it (no reverse-relation
# feature) and would need a custom widget - deliberately not built
# here. Method first, then subtitle: this way the overview groups
# sensibly when sorted by "Methode", not just alphabetically by slug.
# {{commit_date}}/{{commit_author}} are Decap's own tokens fed from the
# Gitea API - checked live, also work in the summary template (not just
# in sortable_fields, where they were originally intended for this
# purpose).
summary: "{{fields.methode}} – {{fields.untertitel}} | {{commit_date | date('D.M.YY')}} {{commit_author}}"
# Decap doesn't automatically offer relation fields (like "methode") in
# "Sort by" (checked live: without this line, only "Untertitel" showed
# up there) - added explicitly, so the overview can also be grouped by
# method. "commit_author"/"commit_date" (Decap's built-in, git-based
# sort options) have to be listed explicitly here too: an explicit
# sortable_fields list REPLACES Decap's default selection entirely,
# instead of extending it - without these two entries they would have
# disappeared from this collection, even though they should appear the
# same way for methods (also explicitly set there now, see above).
# Consistent vocabulary/order with the methods collection above:
# "Methode" first, then - only here in addition, since only variants
# have this field - "Variante" (label for the untertitel field), then
# "Zuletzt geändert am/durch" instead of Decap's default labels
# "Updated On"/"Author" - "Author" would be easily confused here with
# our own "Autor:innen" field, but actually means the commit author.
sortable_fields:
- { field: "methode", label: "Methode" }
- { field: "untertitel", label: "Variante" }
- { field: "commit_date", label: "Zuletzt geändert am" }
- { field: "commit_author", label: "Zuletzt geändert durch" }
format: "frontmatter"
media_folder: ""
public_folder: ""
fields:
# Positive polarity (on = published) instead of a switch that writes
# directly into Hugo's "draft" field: marking "on" as "draft" (as
# required for an inverted draft field) is confusing UX. Decap cannot
# write a boolean field inverted into a differently named
# frontmatter field, so scripts/apply-veroeffentlicht.rb translates
# this field, inverted, into Hugo's native "draft" before every Hugo
# build, in the local _content copy (not in the repo) - Hugo's own
# draft mechanism then takes care of reliable build exclusion, as
# with methods (see above).
- label: "Veröffentlicht (auf der Website sichtbar)"
name: "veroeffentlicht"
widget: "boolean"
default: false
hint: "Häkchen setzen, um diese Variante (und damit auch die zugehörige Methode, siehe deren Hinweistext) auf der Website zu veröffentlichen. Bleibt bis dahin in Git gespeichert, ist aber nur im CMS sichtbar."
- label: "Methode"
name: "methode"
widget: "relation"
collection: "methoden"
search_fields: ["titel"]
display_fields: ["titel"]
# value_field determines what's actually stored/used for the slug -
# "kennung" instead of "titel" (the state before kennung was
# introduced), so that a title change on the method no longer
# breaks this reference (see the project website, background/analysis
# notes, Befund A). search_fields/display_fields stay on
# "titel", so the search in the dropdown still searches by the
# readable name, not the kennung. Neither {{slug}} nor {{dirname}}
# give a cleaned folder name here (reproduced live) - a direct
# field reference to "kennung" is the robust way. Linking in Hugo
# correspondingly happens via Params.kennung, not via Params.titel
# or the filename/slug.
value_field: "kennung"
hint: "Zu welcher Methode gehört diese Variante?"
# Stable identifier of this variant - becomes the second part of the
# folder name (see slug above). Assigned once, never changed
# afterward, see the Manifest chapter on the project website. Unlike the method, nothing
# currently references a variant from outside - kept consistent
# anyway, for later fork merges.
- label: "Kennung"
name: "kennung"
widget: "string"
hint: "Kurz und selbsterklärend. Kleinbuchstaben/Ziffern/Bindestriche/Unterstriche. Wird zum Ordnernamen und eindeutigen Identifier. Nach dem Anlegen nicht mehr ändern."
pattern: ["^[a-z0-9_]+(-[a-z0-9_]+)*$", "Nur Kleinbuchstaben, Ziffern, Unterstriche und Bindestriche, kein Bindestrich am Anfang/Ende"]
- { label: "Untertitel", name: "untertitel", widget: "string", hint: "Ein Wort, das die Besonderheit dieser Variante ausdrückt, z. B. \"Kurzform\" oder \"Sommer\"." }
- { label: "Varianten-Beschreibung", name: "varianten_beschreibung", widget: "text", hint: "Kurze Erläuterung, was diese Variante besonders macht - hilft später bei der Orientierung zwischen mehreren Varianten" }
- { label: "Dauer (Minuten)", name: "dauer_minuten", widget: "number", value_type: "int" }
- { label: "Gruppengröße (mindestens)", name: "gruppengroesse_min", widget: "number", value_type: "int", hint: "Für eine feste Gruppengröße hier und beim Maximum denselben Wert eintragen" }
- { label: "Gruppengröße (höchstens)", name: "gruppengroesse_max", widget: "number", value_type: "int" }
- label: "Material"
name: "material"
widget: "list"
hint: "Was für diese Variante konkret gebraucht wird - andere Varianten derselben Methode können anderes Material brauchen"
summary: "{{fields.eintrag}}"
field: { label: "Material", name: "eintrag", widget: "string" }
# VOKABULAR:lizenz:START
- { label: "Lizenz", name: "lizenz", widget: "string", default: "CC-BY 4.0", hint: "Gilt für diesen Text/diese Ausarbeitung - die Methode-Seite zeigt die Menge aller vorkommenden Lizenzen ihrer Varianten" }
# VOKABULAR:lizenz:END
- label: "Quellen"
name: "quellen"
widget: "list"
required: false
hint: "Worauf sich diese konkrete Ausarbeitung stützt (z. B. eine Handreichung, eine Adaption) - wovon die Methode allgemein abstammt, steht bei ihr selbst unter \"Herkunft\""
summary: "{{fields.eintrag}}"
field: { label: "Quelle", name: "eintrag", widget: "string" }
- label: "Autor:innen"
name: "autoren"
widget: "list"
hint: "Wer diese Variante erarbeitet hat (kann sich von den Initiator:innen der Methode unterscheiden)"
summary: "{{fields.eintrag}}"
field: { label: "Autor:in", name: "eintrag", widget: "string" }
- label: "Inhalt (Vorbereitung, Ablauf, Hintergründe)"
name: "body"
widget: "markdown"
default: |
# Vorbereitung
*Stichsätze, was erledigt werden muss, um mit den Inhalten zu starten (bei Bedarf auch Anmerkungen zum Material).*
# Ablauf
*Detaillierter Ablaufplan mit Anweisungen, möglicherweise in weiteren Überschriftenebenen verschachtelt.*
# Hintergründe
*Erläuterung von Hintergründen (Implizites im Ablauf explizit machen), um die Methode zugänglich zu gestalten.*
- label: "Anhänge"
name: "anhaenge"
widget: "list"
required: false
hint: "Arbeitsblätter, Vorlagen o. Ä. zum Herunterladen - gehören zu dieser Variante, nicht zur Methode allgemein"
# Deliberately no dedicated media_folder subfolder (e.g. "src"): a
# git folder that has never contained a file simply doesn't exist -
# Gitea returns HTTP 400 for that instead of an empty list, and
# Decap only catches 404. The variant's own bundle folder, on the
# other hand, always exists (because of index.md), hence
# attachments live directly there.
fields:
- { label: "Datei", name: "datei", widget: "file" }
- { label: "Beschreibung", name: "beschreibung", widget: "string", hint: "Kurze Einordnung, wofür der Anhang gedacht ist" }
+256
View File
@@ -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>
+17
View File
@@ -0,0 +1,17 @@
// Loads the site title from /site-meta.json (see hugo.toml,
// outputFormats.SiteMeta) instead of hardcoding "Ableger" - these pages run
// without Hugo templating (see the installation guide on the project website). On failure, the
// "Ableger" fallback already in the markup stays. Shared by admin/index.html
// and admin/status/index.html, which only differ in the title suffix -
// passed in via this script tag's own "data-title-suffix" attribute.
(function () {
var suffix = document.currentScript.dataset.titleSuffix || '';
fetch('/site-meta.json')
.then(function (r) { return r.json(); })
.then(function (meta) {
if (!meta.title) return;
document.title = meta.title + suffix;
document.getElementById('site-title-text').textContent = meta.title;
})
.catch(function () {});
})();
+115
View File
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Ableger – Deploy-Status</title>
<link rel="stylesheet" href="/css/style.css">
<style>
/* Standalone static page (no Decap, no nc-root needed) - a plain
HTML/JS page that talks to the small dynamic endpoints under
/admin/status/api/ (see scripts/admin-status-server.rb). Both
paths run behind the same write oauth2-proxy instance as /admin/
itself, see the installation guide on the project website. */
.status-badge {
display: inline-block;
padding: 0.2rem 0.7rem;
border-radius: 999px;
font-size: 0.85rem;
font-weight: 600;
}
.status-badge--ok { background: color-mix(in srgb, var(--color-accent) 15%, transparent); color: var(--color-accent); }
.status-badge--fail { background: rgba(200, 60, 60, 0.15); color: #c83c3c; }
.status-log {
background: var(--color-card-bg);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 1rem;
overflow-x: auto;
white-space: pre-wrap;
font-size: 0.85rem;
max-height: 32rem;
overflow-y: auto;
}
#trigger-status { color: var(--color-muted); font-size: 0.9rem; margin-left: 0.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/">Redaktion</a>
<a href="/">← Zur Website</a>
</nav>
</header>
<main class="site-main">
<h1>Deploy-Status</h1>
<p class="method__lead">Letzter Build (Cron alle 10 Minuten, oder manuell hier ausgelöst) inklusive Prüfskript-Ergebnissen (<code>scripts/validate.rb</code>).</p>
<section class="method__section">
<button type="button" id="trigger-button" class="button block is-primary">Build jetzt auslösen</button>
<span id="trigger-status"></span>
</section>
<section class="method__section" id="status-section">
<p>Lade Status …</p>
</section>
</main>
<script src="/admin/site-meta.js" data-title-suffix=" – Deploy-Status"></script>
<script>
const statusSection = document.getElementById('status-section');
const triggerButton = document.getElementById('trigger-button');
const triggerStatus = document.getElementById('trigger-status');
function render(data) {
if (data.error) {
statusSection.innerHTML = '<p>' + data.error + '</p>';
return;
}
const zeit = new Date(data.timestamp).toLocaleString('de-DE');
const badge = data.success
? '<span class="status-badge status-badge--ok">erfolgreich</span>'
: '<span class="status-badge status-badge--fail">fehlgeschlagen</span>';
statusSection.innerHTML =
'<h2>Letzter Lauf: ' + zeit + ' ' + badge + '</h2>' +
'<pre class="status-log"></pre>';
// Set the log via textContent instead of innerHTML, so that
// characters it contains (e.g. < > from error messages) aren't
// interpreted as HTML.
statusSection.querySelector('.status-log').textContent = data.log || '(kein Log vorhanden)';
}
function load() {
fetch('/admin/status/api/data.json')
.then(function (r) { return r.json(); })
.then(render)
.catch(function () {
statusSection.innerHTML = '<p>Status konnte nicht geladen werden.</p>';
});
}
triggerButton.addEventListener('click', function () {
triggerButton.disabled = true;
triggerStatus.textContent = 'Build läuft …';
fetch('/admin/status/api/trigger', { method: 'POST' })
.then(function (r) { return r.json(); })
.then(function (data) {
render(data);
triggerStatus.textContent = 'Fertig.';
})
.catch(function () {
triggerStatus.textContent = 'Fehlgeschlagen.';
})
.finally(function () {
triggerButton.disabled = false;
});
});
load();
</script>
</body>
</html>