205 lines
6.3 KiB
HTML
205 lines
6.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://assets.cantorgymnasium.de/fonts/mdi/v7/css/materialdesignicons.min.css"
|
|
/>
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://cdn.jsdelivr.net/npm/@staticcms/app@^2.0.0/dist/main.css"
|
|
/>
|
|
<title>Static CMS</title>
|
|
</head>
|
|
<body>
|
|
<script src="https://cdn.jsdelivr.net/npm/@staticcms/app@^2.0.0/dist/static-cms-app.js"></script>
|
|
<script type="module">
|
|
import config from "./config/index.js";
|
|
// imports
|
|
import {
|
|
AboutPreview,
|
|
BlogPreview,
|
|
ContestPreview,
|
|
GanztagPreview,
|
|
PagePreview,
|
|
EventPreview,
|
|
AnmeldungPreview,
|
|
HeaderPreview,
|
|
ChronikPreview,
|
|
KontaktPreview,
|
|
AnmeldeformularPreview,
|
|
ChronikIndexPreview,
|
|
AuthorPreview,
|
|
FormsPreview,
|
|
CantorpreisPreview,
|
|
ProjektwochePreview,
|
|
AbiturientenPreview,
|
|
PreviewStyles,
|
|
} from "./previews/page-previews/index.js";
|
|
import {
|
|
BooleanPreview,
|
|
DraftPreview,
|
|
CountPreview,
|
|
BodyPreview,
|
|
DatePreview,
|
|
} from "./previews/field-previews/index.js";
|
|
import {
|
|
GalleryShortcode,
|
|
ImageShortcode,
|
|
DownloadShortcode,
|
|
CardShortcode,
|
|
YoutubeShortcode,
|
|
AudioShortcode,
|
|
SliderShortcode,
|
|
} from "./shortcodes/index.js";
|
|
import { StatusPage, WikiLink } from "./links/index.js";
|
|
import Icons from "./icons.js";
|
|
|
|
// cms initialization
|
|
CMS.init({ config });
|
|
|
|
// preview templates
|
|
CMS.registerPreviewTemplate("about-index", AboutPreview);
|
|
CMS.registerPreviewTemplate("blog", BlogPreview);
|
|
CMS.registerPreviewTemplate("wettbewerbe", ContestPreview);
|
|
CMS.registerPreviewTemplate("ganztagsangebote", GanztagPreview);
|
|
CMS.registerPreviewTemplate("kontakt", KontaktPreview);
|
|
CMS.registerPreviewTemplate("termine", EventPreview);
|
|
CMS.registerPreviewTemplate("anmeldung-index", AnmeldungPreview);
|
|
CMS.registerPreviewTemplate("chronikjahre", ChronikPreview);
|
|
CMS.registerPreviewTemplate("anmeldeformular", AnmeldeformularPreview);
|
|
CMS.registerPreviewTemplate("schulchronik-index", ChronikIndexPreview);
|
|
CMS.registerPreviewTemplate("author", AuthorPreview);
|
|
CMS.registerPreviewTemplate("forms", FormsPreview);
|
|
CMS.registerPreviewTemplate("cantorpreis", CantorpreisPreview);
|
|
CMS.registerPreviewTemplate("begabte", ContestPreview);
|
|
["projektwoche", "superhaufen"].forEach((page) =>
|
|
CMS.registerPreviewTemplate(page, ProjektwochePreview)
|
|
);
|
|
["abiturienten", "cantorfora"].forEach((page) =>
|
|
CMS.registerPreviewTemplate(page, AbiturientenPreview)
|
|
);
|
|
[
|
|
"blog-index",
|
|
"cantorpreis-index",
|
|
"forms-index",
|
|
"ganztagsangebote-index",
|
|
"wettbewerbe-index",
|
|
"begabte-index",
|
|
"abiturienten-index",
|
|
"projektwoche-index",
|
|
"author-index",
|
|
].forEach((page) => CMS.registerPreviewTemplate(page, HeaderPreview));
|
|
[
|
|
"abiturienten",
|
|
"cantorfora-index",
|
|
"pages",
|
|
"anmeldeformular",
|
|
"schulchronik-index",
|
|
"chronikseiten",
|
|
].forEach((page) => CMS.registerPreviewTemplate(page, PagePreview));
|
|
|
|
PreviewStyles.forEach((url) => {
|
|
CMS.registerPreviewStyle(url);
|
|
});
|
|
|
|
//shortcodes
|
|
CMS.registerShortcode("gallery", GalleryShortcode);
|
|
CMS.registerShortcode("image", ImageShortcode);
|
|
CMS.registerShortcode("download", DownloadShortcode);
|
|
CMS.registerShortcode("card", CardShortcode);
|
|
CMS.registerShortcode("youtube", YoutubeShortcode);
|
|
CMS.registerShortcode("audio", AudioShortcode);
|
|
CMS.registerShortcode("slider", SliderShortcode);
|
|
|
|
// links
|
|
CMS.registerAdditionalLink(StatusPage);
|
|
CMS.registerAdditionalLink(WikiLink);
|
|
|
|
// icons
|
|
Icons.forEach((i) => CMS.registerIcon(i.name, i.icon));
|
|
|
|
// field previews
|
|
CMS.registerFieldPreview("author", "active", BooleanPreview);
|
|
CMS.registerFieldPreview("author", "simplified", BooleanPreview);
|
|
CMS.registerFieldPreview("blog", "date", DatePreview);
|
|
CMS.registerFieldPreview("chronikjahre", "topics", CountPreview);
|
|
["projektwoche", "superhaufen"].forEach((collection) =>
|
|
CMS.registerFieldPreview(collection, "tiles", CountPreview)
|
|
);
|
|
[
|
|
"forms",
|
|
"blog",
|
|
"cantorpreis",
|
|
"pages",
|
|
"ganztagsangebote",
|
|
"wettbewerbe",
|
|
"begabte",
|
|
"projektwoche",
|
|
"chronikjahre",
|
|
"abiturienten",
|
|
"superhaufen",
|
|
"cantorfora",
|
|
"chronikseiten",
|
|
].forEach((collection) =>
|
|
CMS.registerFieldPreview(collection, "draft", DraftPreview)
|
|
);
|
|
[
|
|
"blog",
|
|
"author",
|
|
"chronikseiten",
|
|
"pages",
|
|
"cantorpreis",
|
|
"begabte",
|
|
].forEach((collection) =>
|
|
CMS.registerFieldPreview(collection, "body", BodyPreview)
|
|
);
|
|
[
|
|
"cantorpreis-index",
|
|
"wettbewerbe-index",
|
|
"abiturienten-index",
|
|
"pages",
|
|
"projektwoche",
|
|
"cantorfora",
|
|
"blog-index",
|
|
"about-index",
|
|
"anmeldung-index",
|
|
"kontakt",
|
|
"termine",
|
|
"forms-index",
|
|
"ganztagsangebote-index",
|
|
"begabte-index",
|
|
"projektwoche-index",
|
|
].forEach((collection) =>
|
|
CMS.registerFieldPreview(collection, "description", BodyPreview)
|
|
);
|
|
["chronikseiten", "blog"].forEach((collection) =>
|
|
CMS.registerFieldPreview(collection, "title", BodyPreview)
|
|
);
|
|
|
|
// access control
|
|
CMS.registerEventListener({
|
|
name: "login",
|
|
handler: ({ login }) => {
|
|
const adminUsers = [
|
|
"Tramus00",
|
|
"denyskon",
|
|
"gfelke",
|
|
"lberthold",
|
|
"cschapitz",
|
|
"bgorsler",
|
|
];
|
|
if (login && !adminUsers.includes(login)) {
|
|
alert(
|
|
"Sie sind nicht berechtigt, diese Seite aufzurufen. Sie werden nun auf die Startseite weitergeleitet."
|
|
);
|
|
location.href = "/";
|
|
}
|
|
},
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|