Static CMS v4 #250

Merged
Denys Konovalov merged 3 commits from scmsv4 into master 2023-12-11 20:07:25 +01:00
22 changed files with 143 additions and 121 deletions

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, ImageProps } from "../props.js";
import { DraftBoolean, Title } from "./widgets.js";
const AbiturientenCollection = {
@ -33,9 +33,8 @@ const AbiturientenCollection = {
{
name: "image",
label: "Bild",
widget: "image",
default: "/media/image.webp",
required: false,
...ImageProps,
},
{
name: "type",
@ -46,7 +45,6 @@ const AbiturientenCollection = {
{
name: "body",
label: "Text",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -1,4 +1,4 @@
import { MarkdownProps, PatternEmail } from "../props.js";
import { MarkdownProps, PatternEmail, ImageProps } from "../props.js";
import { DescriptionText } from "./widgets.js";
const AuthorCollection = {
@ -19,38 +19,49 @@ const AuthorCollection = {
field: "type",
value: "author",
},
view_filters: [
{
label: "aktiv",
field: "active",
pattern: true,
},
{
label: "inaktiv",
field: "active",
pattern: false,
},
{
label: "einfach",
field: "simplified",
pattern: true,
},
{
label: "erweitert",
field: "simplified",
pattern: false,
},
],
view_groups: [
{
label: "vereinfacht",
field: "simplified",
},
{
label: "aktiv",
field: "active",
},
],
view_filters: {
filters: [
{
name: "active",
label: "aktiv",
field: "active",
pattern: true,
},
{
name: "inactive",
label: "inaktiv",
field: "active",
pattern: false,
},
{
name: "simplified",
label: "einfach",
field: "simplified",
pattern: true,
},
{
name: "extended",
label: "erweitert",
field: "simplified",
pattern: false,
},
],
},
view_groups: {
default: "active",
groups: [
{
name: "simplified",
label: "vereinfacht",
field: "simplified",
},
{
name: "active",
label: "aktiv",
field: "active",
},
],
},
summary_fields: ["title", "active", "simplified", "body"],
fields: [
{
@ -70,9 +81,8 @@ const AuthorCollection = {
{
name: "image",
label: "Bild",
widget: "image",
required: false,
default: "/media/people/gcg.webp",
...ImageProps,
},
{
name: "simplified",
@ -96,7 +106,6 @@ const AuthorCollection = {
{
name: "body",
label: "Beschreibung",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, ImageProps } from "../props.js";
import { DescriptionText, DraftBoolean, Title } from "./widgets.js";
const BegabteCollection = {
@ -27,9 +27,9 @@ const BegabteCollection = {
{
name: "image",
label: "Titelbild",
widget: "image",
required: true,
default: "/media/image.webp",
...ImageProps,
required: true,
},
{
name: "class",
@ -52,7 +52,6 @@ const BegabteCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: true,
...MarkdownProps,
},

@ -1,4 +1,4 @@
import { DateFormat, MarkdownProps } from "../props.js";
import { DateFormat, MarkdownProps, ImageProps } from "../props.js";
import {
AuthorRelation,
DescriptionText,
@ -24,12 +24,16 @@ const BlogCollection = {
field: "type",
value: "post",
},
view_groups: [
{
label: "Entwurf",
field: "draft",
},
],
view_groups: {
default: "draft",
groups: [
{
name: "draft",
label: "Entwurf",
field: "draft",
},
],
},
sortable_fields: {
fields: ["date", "title"],
default: {
@ -53,9 +57,9 @@ const BlogCollection = {
name: "image",
label: "Titelbild",
hint: "16:9 Seitenverhältnis beachten",
widget: "image",
required: true,
default: "/media/image.webp",
...ImageProps,
required: true,
},
AuthorRelation,
{
@ -102,7 +106,6 @@ const BlogCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: true,
...MarkdownProps,
},

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, ImageProps } from "../props.js";
import { DescriptionText, DraftBoolean, Title } from "./widgets.js";
const CantorforaCollection = {
@ -19,12 +19,6 @@ const CantorforaCollection = {
frame: true,
size: "half",
},
view_groups: [
{
label: "Entwürfe",
field: "draft",
},
],
summary_fields: ["title", "draft", "description"],
sortable_fields: {
fields: ["index", "title"],
@ -50,8 +44,8 @@ const CantorforaCollection = {
{
name: "image",
label: "Titelbild",
widget: "image",
default: "/media/image.webp",
...ImageProps,
required: true,
},
{
@ -63,7 +57,6 @@ const CantorforaCollection = {
{
name: "body",
label: "Text",
widget: "markdown",
required: true,
...MarkdownProps,
},

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, ImageProps } from "../props.js";
import { DescriptionText, DraftBoolean } from "./widgets.js";
const CantorpreisCollection = {
@ -45,9 +45,8 @@ const CantorpreisCollection = {
{
name: "image",
label: "Bild",
widget: "image",
default: "/media/image.webp",
required: false,
...ImageProps,
},
{
name: "type",
@ -58,7 +57,6 @@ const CantorpreisCollection = {
{
name: "body",
label: "Text",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -43,7 +43,6 @@ const ChronikjahreCollection = {
name: "pretext",
label: "Einleitung",
hint: "Text für die Jahreszahl",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -64,7 +63,6 @@ const ChronikjahreCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -102,7 +100,6 @@ const ChronikjahreCollection = {
name: "body",
label: "Text",
hint: "Erscheint zusätzlich zu den Kreativen Haufen",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -48,7 +48,6 @@ const ChronikseitenCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -55,7 +55,6 @@ const FormsCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, ImageProps } from "../props.js";
import { Title, DescriptionText, DraftBoolean } from "./widgets.js";
const GanztagCollection = {
@ -27,8 +27,8 @@ const GanztagCollection = {
{
name: "image",
label: "Titelbild",
widget: "image",
default: "/media/ganztagsangebote/image.webp",
...ImageProps,
required: true,
},
{
@ -82,7 +82,6 @@ const GanztagCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -3,6 +3,7 @@ import {
DateFormat,
MarkdownProps,
PatternEmail,
ImageProps
} from "../props.js";
import { DescriptionText, EnableBoolean, Title } from "./widgets.js";
@ -36,8 +37,7 @@ const IndexPagesCollection = {
{
name: "image",
label: "Bild",
widget: "image",
required: false,
...ImageProps,
},
{
name: "stats",
@ -75,7 +75,6 @@ const IndexPagesCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -91,7 +90,6 @@ const IndexPagesCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -107,7 +105,6 @@ const IndexPagesCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: true,
...MarkdownProps,
},
@ -131,7 +128,6 @@ const IndexPagesCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -273,7 +269,6 @@ const IndexPagesCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -289,7 +284,6 @@ const IndexPagesCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -302,8 +296,7 @@ const IndexPagesCollection = {
{
name: "image",
label: "Bild",
widget: "image",
required: false,
...ImageProps,
},
{
name: "quote",

@ -48,7 +48,6 @@ const PagesCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},

@ -32,7 +32,6 @@ const ProjektwocheCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -61,7 +60,6 @@ const ProjektwocheCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: true,
...MarkdownProps,
},

@ -3,6 +3,7 @@ import {
DateFormat,
MarkdownProps,
PatternEmail,
ImageProps
} from "../props.js";
import {
ButtonObject,
@ -40,7 +41,6 @@ const SettingsCollection = {
{
name: "text",
label: "Text",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -90,7 +90,7 @@ const SettingsCollection = {
{
name: "bg_image",
label: "Hintergrundbild",
widget: "image",
...ImageProps,
required: true,
},
Title(false),
@ -136,7 +136,7 @@ const SettingsCollection = {
{
name: "image",
label: "Grafik",
widget: "image",
...ImageProps,
required: true,
},
],
@ -153,7 +153,6 @@ const SettingsCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -175,7 +174,7 @@ const SettingsCollection = {
{
name: "image",
label: "Hintergrundbild",
widget: "image",
...ImageProps,
required: true,
},
{
@ -200,13 +199,11 @@ const SettingsCollection = {
{
name: "image",
label: "Grafik",
widget: "image",
required: false,
...ImageProps,
},
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -228,7 +225,6 @@ const SettingsCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -269,14 +265,13 @@ const SettingsCollection = {
{
name: "bg_image",
label: "Hintergrundbild",
widget: "image",
...ImageProps,
required: true,
},
Title(false),
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -304,13 +299,11 @@ const SettingsCollection = {
{
name: "image",
label: "Bild",
widget: "image",
required: false,
...ImageProps,
},
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -340,7 +333,7 @@ const SettingsCollection = {
{
name: "image",
label: "Grafik",
widget: "image",
...ImageProps,
required: true,
},
],
@ -360,13 +353,12 @@ const SettingsCollection = {
{
name: "image",
label: "Titelbild",
widget: "image",
...ImageProps,
required: true,
},
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: false,
...MarkdownProps,
},
@ -512,7 +504,7 @@ const SettingsCollection = {
{
name: "logo",
label: "Logo",
widget: "image",
...ImageProps,
required: true,
},
{
@ -579,13 +571,13 @@ const SettingsCollection = {
{
name: "preloader",
label: "Logo",
widget: "image",
...ImageProps,
required: true,
},
{
name: "loader",
label: "Ladeanimation",
widget: "image",
...ImageProps,
required: true,
},
],
@ -630,7 +622,6 @@ const SettingsCollection = {
name: "copyright",
label: "Copyright-Eintrag",
hint: "Am Seitenende sichtbar",
widget: "markdown",
required: true,
...MarkdownProps,
},

@ -74,8 +74,7 @@ const SuperhaufenCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: true,
required: false,
...MarkdownProps,
},
{
@ -89,8 +88,7 @@ const SuperhaufenCollection = {
{
name: "content",
label: "Inhalt",
widget: "markdown",
required: true,
required: false,
...MarkdownProps,
},
],

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, ImageProps } from "../props.js";
import { DescriptionText, DraftBoolean, Title } from "./widgets.js";
const WettbewerbeCollection = {
@ -26,7 +26,7 @@ const WettbewerbeCollection = {
{
name: "image",
label: "Titelbild",
widget: "image",
...ImageProps,
required: true,
default: "/media/image.webp",
},
@ -63,7 +63,6 @@ const WettbewerbeCollection = {
{
name: "body",
label: "Inhalt",
widget: "markdown",
required: true,
...MarkdownProps,
},

@ -17,6 +17,7 @@ import {
SuperhaufenCollection,
WettbewerbeCollection,
} from "./collections/index.js";
import { GCGThemeDark, GCGThemeLight } from "./themes.js";
const config = {
backend: {
@ -48,6 +49,13 @@ const config = {
clean_accents: true,
sanitize_replacement: "-",
},
theme: {
include_built_in_themes: false,
themes: [
GCGThemeDark,
GCGThemeLight
]
},
collections: [
SettingsCollection,
IndexPagesCollection,

@ -1,4 +1,5 @@
const MarkdownProps = {
widget: "markdown",
toolbar_buttons: {
main: [
"bold",
@ -74,4 +75,12 @@ const PatternEmail = {
],
};
export { MarkdownProps, DateFormat, DataObject, PatternEmail };
const ImageProps = {
widget: "image",
required: false,
media_library: {
folder_support: true,
}
};
export { MarkdownProps, DateFormat, DataObject, PatternEmail, ImageProps };

@ -7,6 +7,7 @@ import {
StatsCollection,
SuperhaufenCollection,
} from "./collections/index.js";
import { GCGThemeDark, GCGThemeLight } from "./themes.js";
const config = {
backend: {
@ -38,6 +39,13 @@ const config = {
clean_accents: true,
sanitize_replacement: "-",
},
theme: {
include_built_in_themes: false,
themes: [
GCGThemeDark,
GCGThemeLight
]
},
collections: [
ChronikjahreCollection,
SuperhaufenCollection,

@ -0,0 +1,25 @@
const GCGThemeDark = {
name: "GCG.Dark",
extends: "dark",
primary: {
main: "#ffbc3b",
contrastColor: "#4b4b4b",
},
background: {
main: "#1a1a37",
dark: "#13132d",
},
};
const GCGThemeLight = {
name: "GCG.Light",
extends: "light",
primary: {
main: "#1a1a37",
},
background: {
dark: "#f1f3f5",
},
};
export { GCGThemeDark, GCGThemeLight };

@ -9,12 +9,12 @@
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@staticcms/app@^3.0.0/dist/main.css"
href="https://unpkg.com/@staticcms/app@next/dist/main.css"
/>
<title>Static CMS</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@staticcms/app@^3.0.0/dist/static-cms-app.js"></script>
<script src="https://unpkg.com/@staticcms/app@next/dist/static-cms-app.js"></script>
<script type="module">
import config from "./config/index.js";
// imports

@ -9,12 +9,12 @@
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@staticcms/app@^3.0.0/dist/main.css"
href="https://unpkg.com/@staticcms/app@next/dist/main.css"
/>
<title>Chronikverwaltung</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@staticcms/app@^3.0.0/dist/static-cms-app.js"></script>
<script src="https://unpkg.com/@staticcms/app@next/dist/static-cms-app.js"></script>
<script type="module">
import config from "../../admin/config/schulchronik.js";
// imports