diff --git a/static/admin/config.yml b/static/admin/config.yml index 4a97cd41..48409a3a 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -960,7 +960,7 @@ collections: name: "previous" widget: "object" fields: - - {label: "Aktiviert", name: "enable", widget: "hidden", default: true} + - {label: "Aktiviert", name: "enable", widget: "boolean", default: true} - {label: "Titel", name: "title", widget: "string", required: true} - {label: "Link", name: "link", widget: "string", required: true} - label: "Kacheln" diff --git a/static/admin/config/collections/abiturienten.js b/static/admin/config/collections/abiturienten.js new file mode 100644 index 00000000..84554b78 --- /dev/null +++ b/static/admin/config/collections/abiturienten.js @@ -0,0 +1,54 @@ +import { MarkdownProps } from "../props.js"; +import { DraftBoolean, Title } from "./widgets.js"; + +const AbiturientenCollection = { + name: "abiturienten", + label: "Abiturienten", + label_singular: "Abiturjahrgang", + description: "Hier kann die Übersicht der Abiturjahrgänge bearbeitet werden. Dieser Bereich wird von der Schulchronik verwaltet.", + icon: "graduation-cap", + folder: "content/german/abiturienten", + filter: { + field: "type", + value: "abiturienten" + }, + create: true, + editor: { + preview: true, + frame: true + }, + summary_fields: ["title", "draft"], + sortable_fields: { + fields: ["title"], + default: { + field: "title", + direction: "Descending" + } + }, + fields: [ + Title(false), + DraftBoolean, + { + name: "image", + label: "Bild", + widget: "image", + default: "/media/image.webp", + required: false + }, + { + name: "type", + label: "Typ", + widget: "hidden", + default: "abiturienten" + }, + { + name: "body", + label: "Text", + widget: "markdown", + required: false, + ...MarkdownProps + } + ] +}; + +export default AbiturientenCollection; \ No newline at end of file diff --git a/static/admin/config/collections/cantorfora.js b/static/admin/config/collections/cantorfora.js new file mode 100644 index 00000000..1664a3da --- /dev/null +++ b/static/admin/config/collections/cantorfora.js @@ -0,0 +1,71 @@ +import { MarkdownProps } from "../props.js"; +import { DescriptionText, DraftBoolean, Title } from "./widgets.js"; + +const CantorforaCollection = { + name: "cantorfora", + label: "Cantorfora", + label_singular: "Cantorforum", + description: "Hier kann die Übersicht der Cantorfora bearbeitet werden. Dieser Bereich wird von der Schulchronik verwaltet.", + icon: "presentation", + folder: "content/german/cantorfora", + filter: { + field: "type", + value: "cantorfora" + }, + create: true, + editor: { + preview: true, + frame: true + }, + view_groups: [ + { + label: "Entwürfe", + field: "draft" + } + ], + summary_fields: ["title", "draft", "description"], + sortable_fields: { + fields: ['index', 'title'], + default: { + field: "index", + direction: "Descending" + } + }, + fields: [ + Title(false), + { + name: "index", + label: "Laufindex", + hint: "Nummer des Cantorforums", + widget: "number", + value_type: "int", + min: 1, + step: 1, + required: true + }, + DraftBoolean, + DescriptionText, + { + name: "image", + label: "Titelbild", + widget: "image", + default: "/media/image.webp", + required: true + }, + { + name: "type", + label: "Typ", + widget: "hidden", + default: "cantorfora" + }, + { + name: "body", + label: "Text", + widget: "markdown", + required: true, + ...MarkdownProps + } + ] +}; + +export default CantorforaCollection; \ No newline at end of file diff --git a/static/admin/config/collections/cantorpreis.js b/static/admin/config/collections/cantorpreis.js new file mode 100644 index 00000000..2fbcba1f --- /dev/null +++ b/static/admin/config/collections/cantorpreis.js @@ -0,0 +1,66 @@ +import { MarkdownProps } from "../props.js"; +import { DescriptionText, DraftBoolean } from "./widgets.js"; + +const CantorpreisCollection = { + name: "cantorpreis", + label: "Cantorpreisträger", + description: "Hier sind alle Cantorpreisträger aufgelistet. Dieser Bereich wird von der Schulchronik verwaltet.", + icon: "award", + folder: "content/german/cantorpreis", + filter: { + field: "type", + value: "cantorpreis" + }, + sortable_fields: { + fields: ['title', 'name'], + default: { + field: "title", + direction: "Descending" + } + }, + summary: "{{title}} - {{name}}", + create: true, + editor: { + preview: true, + frame: true + }, + summary_fields: ["title", "name", "draft", "body"], + fields: [ + { + name: "title", + label: "Jahr", + widget: "string", + required: true + }, + { + name: "name", + label: "Name", + widget: "string", + required: true + }, + DraftBoolean, + DescriptionText, + { + name: "image", + label: "Bild", + widget: "image", + default: "/media/image.webp", + required: false + }, + { + name: "type", + label: "Typ", + widget: "hidden", + default: "cantorpreis" + }, + { + name: "body", + label: "Text", + widget: "markdown", + required: false, + ...MarkdownProps + } + ] +}; + +export default CantorpreisCollection; \ No newline at end of file diff --git a/static/admin/config/collections/chronikjahre.js b/static/admin/config/collections/chronikjahre.js new file mode 100644 index 00000000..b01fc1e9 --- /dev/null +++ b/static/admin/config/collections/chronikjahre.js @@ -0,0 +1,111 @@ +import { MarkdownProps } from "../props.js"; +import { DraftBoolean, EnableBoolean } from "./widgets.js"; + +const ChronikjahreCollection = { + name: "chronikjahre", + description: "Hier können die Chronikjahre bearbeitet werden. Dieser Bereich wird von der Schulchronik verwaltet.", + icon: "schulchronik", + label: "Chronikjahre", + label_singular: "Chronikjahr", + folder: "content/german/schulchronik", + filter: { + field: "type", + value: "schulchronik" + }, + create: true, + editor: { + preview: false + }, + summary_fields: ["title", "draft", "cantorpreisträger", "topics"], + sortable_fields: { + fields: ['title'], + default: { + field: "title", + direction: "Descending" + } + }, + fields: [ + { + name: "title", + label: "Jahr", + widget: "string" + }, + DraftBoolean, + { + name: "type", + label: "Typ", + widget: "hidden", + default: "schulchronik" + }, + { + name: "pretext", + label: "Einleitung", + hint: "Text für die Jahreszahl", + widget: "markdown", + required: false, + ...MarkdownProps + }, + { + name: "topics", + label: "Kreative Haufen", + label_singular: "Haufen", + widget: "list", + required: false, + collapsed: true, + fields: [ + { + name: "title", + label: "Titel", + widget: "string", + required: true, + }, + { + name: "content", + label: "Inhalt", + widget: "markdown", + required: false, + ...MarkdownProps + }, + { + name: "superhaufen", + label: "Superhaufen", + widget: "object", + required: false, + fields: [ + EnableBoolean, + { + name: "link", + label: "Superhaufen", + widget: "relation", + collection: "superhaufen", + search_fields: ["title"], + value_field: "title", + required: false, + collapsed: true + } + ] + } + ] + }, + { + name: "cantorpreisträger", + label: "Cantorpreisträger", + widget: "relation", + collection: "cantorpreis", + search_fields: ["jahr", "name"], + value_field: "name", + required: false + }, + { + name: "body", + label: "Text", + hint: "Erscheint zusätzlich zu den Kreativen Haufen", + widget: "markdown", + required: false, + ...MarkdownProps + } + + ] +} + +export default ChronikjahreCollection; \ No newline at end of file diff --git a/static/admin/config/collections/index.js b/static/admin/config/collections/index.js new file mode 100644 index 00000000..38a875c5 --- /dev/null +++ b/static/admin/config/collections/index.js @@ -0,0 +1,8 @@ +import SettingsCollection from "./settings-collection.js"; +import ChronikjahreCollection from "./chronikjahre.js"; +import SuperhaufenCollection from "./superhaufen.js"; +import CantorpreisCollection from "./cantorpreis.js"; +import AbiturientenCollection from "./abiturienten.js"; +import CantorforaCollection from "./cantorfora.js"; + +export { SettingsCollection, ChronikjahreCollection, SuperhaufenCollection, CantorpreisCollection, AbiturientenCollection, CantorforaCollection }; \ No newline at end of file diff --git a/static/admin/config/collections/settings-collection.js b/static/admin/config/collections/settings-collection.js new file mode 100644 index 00000000..1d72283c --- /dev/null +++ b/static/admin/config/collections/settings-collection.js @@ -0,0 +1,135 @@ +import { DateFormat, MarkdownProps } from "../props.js"; +import { EnableBoolean, Title } from "./widgets.js"; + +const SettingsCollection = { + name: "settings", + label: "Einstellungen", + icon: "settings", + description: "Hier können die Basiseinstellungen der Website geändert werden. Die meisten Bereiche müssen nur in Ausnahmefällen angepasst werden.", + editor: { + preview: false + }, + files: [ + { + name: "data-homepage", + label: "Startseiteneinstellungen", + file: "data/de/homepage.yml", + fields: [ + { + name: "top_banner", + label: "Banner", + widget: "object", + collapsed: true, + summary: "{{fields.enable | ternary('aktiv', 'inaktiv')}}", + fields: [ + EnableBoolean, + { + name: "text", + label: "Text", + widget: "markdown", + required: false, + ...MarkdownProps + }, + { + name: "color", + label: "Farbe", + widget: "color", + required: false + }, + { + name: "font_color", + label: "Schriftfarbe", + widget: "color", + required: false + }, + { + name: "icon", + label: "Symbol", + widget: "string", + required: false, + hint: "Liste unter https://assets.cantorgymnasium.de/fonts/mdi/v7/preview.html" + }, + { + name: "temporarily", + label: "Zeitschaltung", + widget: "object", + fields: [ + EnableBoolean, + { + name: "start_date", + label: "Startdatum", + widget: "datetime", + ...DateFormat, + required: false, + }, + { + name: "end_date", + label: "Enddatum", + widget: "datetime", + ...DateFormat, + required: false, + } + ] + } + ] + }, + { + name: "slider", + label: "Karusell", + widget: "object", + collapsed: true, + summary: "{{fields.enable | ternary('aktiv', 'inaktiv')}}", + fields: [ + EnableBoolean, + { + name: "bg_image", + label: "Hintergrundbild", + widget: "image", + required: false, + }, + Title(true), + { + name: "slider_item", + label: "Elemente", + label_singular: "Element", + widget: "list", + collapsed: true, + fields: [ + { + name: "content", + label: "Text", + widget: "string", + required: false + }, + { + name: "button", + label: "Button", + widget: "object", + required: false, + collapsed: true, + fields: [ + EnableBoolean, + { + name: "label", + label: "Aufschrift", + widget: "string", + required: false + }, + { + name: "link", + label: "Link", + widget: "string", + required: false + } + ] + } + ] + } + ] + } + ] + } + ] +}; + +export default SettingsCollection; \ No newline at end of file diff --git a/static/admin/config/collections/superhaufen.js b/static/admin/config/collections/superhaufen.js new file mode 100644 index 00000000..6b0f335e --- /dev/null +++ b/static/admin/config/collections/superhaufen.js @@ -0,0 +1,101 @@ +import { MarkdownProps } from "../props.js"; +import { DraftBoolean, EnableBoolean, Title } from "./widgets.js"; + +const SuperhaufenCollection = { + name: "superhaufen", + label: "Superhaufen", + description: "\"Superhaufen\" sind ein besonderer Bereich der Schulchronik, um besonders ausführliche Ereignisse darzustellen. Dieser Bereich wird von der Schulchronik verwaltet.", + icon: "superhaufen", + folder: "content/german/superhaufen", + filter: { + field: "type", + value: "superhaufen" + }, + create: true, + editor: { + preview: true, + frame: true, + }, + summary_fields: ["title", "draft", "tiles"], + fields: [ + Title(false), + DraftBoolean, + { + name: "type", + label: "Typ", + widget: "hidden", + default: "superhaufen" + }, + { + name: "previous", + label: "Rückverlinkung", + widget: "object", + collapsed: true, + fields: [ + EnableBoolean, + Title(false), + { + name: "link", + label: "Link", + widget: "string", + required: true + } + ] + }, + { + name: "tiles", + label: "Kacheln", + hint: "Die Vorschau zeigt nur die generierten Symbolkarten, NICHT die Inhalte.", + widget: "list", + required: false, + collapsed: true, + fields: [ + Title(false), + { + name: "bg_color", + label: "Hintergrundfarbe", + widget: "color", + required: true, + }, + { + name: "icon", + label: "Symbol", + widget: "string", + required: true, + }, + { + name: "font_color", + label: "Symbolfarbe", + widget: "color", + required: true, + }, + { + name: "content", + label: "Inhalt", + widget: "markdown", + required: true, + ...MarkdownProps + }, + { + name: "unterhaufen", + label: "Unterhaufen", + widget: "list", + required: false, + collapsed: true, + fields: [ + Title(false), + { + name: "content", + label: "Inhalt", + widget: "markdown", + required: true, + ...MarkdownProps + } + ] + } + ] + } + ] +} + +export default SuperhaufenCollection; \ No newline at end of file diff --git a/static/admin/config/collections/widgets.js b/static/admin/config/collections/widgets.js new file mode 100644 index 00000000..1ed5292b --- /dev/null +++ b/static/admin/config/collections/widgets.js @@ -0,0 +1,30 @@ +const EnableBoolean = { + name: "enable", + label: "Aktivieren", + widget: "boolean", + required: false +}; + +const DraftBoolean = { + name: "draft", + label: "Entwurf", + widget: "boolean", + default: false, + required: false +} + +const Title = (optional = false) => ({ + name: "title", + label: "Titel", + widget: "string", + required: !optional +}); + +const DescriptionText = { + name: "description", + label: "Beschreibung", + widget: "text", + required: false +}; + +export { EnableBoolean, DraftBoolean, Title, DescriptionText }; \ No newline at end of file diff --git a/static/admin/config/index.js b/static/admin/config/index.js new file mode 100644 index 00000000..53debbdb --- /dev/null +++ b/static/admin/config/index.js @@ -0,0 +1,37 @@ +import { SettingsCollection } from "./collections/index.js"; + +const config = { + backend: { + name: "gitea", + repo: "gcg/gcg-website", + branch: "master", + api_root: "https://git.cantorgymnasium.de/api/v1", + base_url: "https://oauth.cantorgymnasium.de", + commit_messages: { + create: "{{collection}} {{slug}} erstellt", + update: "{{collection}} {{slug}} aktualisiert", + delete: "{{collection}} {{slug}} gelöscht", + updateMedia: "{{path}} hochgeladen", + deleteMedia: "{{path}} gelöscht" + } + }, + local_backend: true, + media_folder: "/static/media", + public_folder: "/media", + media_library: { + max_file_size: 10240000, + folder_support: true + }, + site_url: "https://cantorgymnasium.de", + locale: "de", + slug: { + encoding: "ascii", + clean_accents: true, + sanitize_replacement: "-" + }, + collections: [ + SettingsCollection + ] +}; + +export default config; \ No newline at end of file diff --git a/static/admin/config/props.js b/static/admin/config/props.js new file mode 100644 index 00000000..a7394503 --- /dev/null +++ b/static/admin/config/props.js @@ -0,0 +1,56 @@ +const MarkdownProps = { + toolbar_buttons: { + main: [ + 'bold', + 'italic', + 'strikethrough', + 'code', + 'font', + 'unordered-list', + 'ordered-list', + 'decrease-indent', + 'increase-indent', + 'insert-table', + 'blockquote', + 'file-link', + 'code-block', + 'shortcode', + ], + empty: [], + selection: ['bold', 'italic', 'strikethrough', 'code', 'font', 'file-link', 'blockquote'], + table_empty: [ + 'bold', + 'italic', + 'strikethrough', + 'code', + 'insert-row', + 'delete-row', + 'insert-column', + 'delete-column', + 'delete-table', + 'file-link', + 'shortcode', + ], + table_selection: [ + 'bold', + 'italic', + 'strikethrough', + 'code', + 'insert-row', + 'delete-row', + 'insert-column', + 'delete-column', + 'delete-table', + 'file-link', + 'shortcode', + ] + } +}; + +const DateFormat = { + date_format: "dd.MM.yyyy", + time_format: false, + format: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" +}; + +export { MarkdownProps, DateFormat }; \ No newline at end of file diff --git a/static/admin/config/schulchronik.js b/static/admin/config/schulchronik.js new file mode 100644 index 00000000..bb481486 --- /dev/null +++ b/static/admin/config/schulchronik.js @@ -0,0 +1,42 @@ +import { AbiturientenCollection, CantorforaCollection, CantorpreisCollection, ChronikjahreCollection, SuperhaufenCollection } from "./collections/index.js"; + + +const config = { + backend: { + name: "gitea", + repo: "gcg/gcg-website", + branch: "master", + api_root: "https://git.cantorgymnasium.de/api/v1", + base_url: "https://oauth.cantorgymnasium.de", + commit_messages: { + create: "{{collection}} {{slug}} erstellt", + update: "{{collection}} {{slug}} aktualisiert", + delete: "{{collection}} {{slug}} gelöscht", + updateMedia: "{{path}} hochgeladen", + deleteMedia: "{{path}} gelöscht" + } + }, + local_backend: true, + media_folder: "/static/media", + public_folder: "/media", + media_library: { + max_file_size: 10240000, + folder_support: true + }, + site_url: "https://cantorgymnasium.de/schulchronik/", + locale: "de", + slug: { + encoding: "ascii", + clean_accents: true, + sanitize_replacement: "-" + }, + collections: [ + ChronikjahreCollection, + SuperhaufenCollection, + CantorpreisCollection, + AbiturientenCollection, + CantorforaCollection + ] +}; + +export default config; \ No newline at end of file diff --git a/static/admin/icons.js b/static/admin/icons.js index bd67f9b3..3c0e9f02 100644 --- a/static/admin/icons.js +++ b/static/admin/icons.js @@ -9,7 +9,7 @@ const IconNames = { group: "mdi mdi-crowd", trophy: "mdi mdi-trophy-outline", pi: "mdi mdi-pi-box", - pillar: "mdi mdi-pillar", + schulchronik: "mdi mdi-pillar", "graduation-cap": "mdi mdi-school-outline", help: "mdi mdi-lifebuoy", dash: "mdi mdi-monitor-dashboard", diff --git a/static/admin/index.html b/static/admin/index.html index def7acc9..7e7bd7c1 100644 --- a/static/admin/index.html +++ b/static/admin/index.html @@ -10,6 +10,7 @@
- - - - - + - - - - -