gcg-website/static/admin/index.html

205 lines
6.3 KiB
HTML
Raw Normal View History

2023-01-10 22:23:04 +01:00
<!DOCTYPE html>
2020-07-11 13:45:14 +02:00
<html>
2023-01-10 22:23:04 +01:00
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2023-05-29 16:22:34 +02:00
<link
rel="stylesheet"
href="https://assets.cantorgymnasium.de/fonts/mdi/v7/css/materialdesignicons.min.css"
/>
<link
rel="stylesheet"
2023-09-19 17:10:24 +02:00
href="https://cdn.jsdelivr.net/npm/@staticcms/app@^3.0.0/dist/main.css"
2023-05-29 16:22:34 +02:00
/>
2023-01-10 22:23:04 +01:00
<title>Static CMS</title>
</head>
<body>
2023-09-19 17:10:24 +02:00
<script src="https://cdn.jsdelivr.net/npm/@staticcms/app@^3.0.0/dist/static-cms-app.js"></script>
<script type="module">
2023-05-11 06:44:30 +02:00
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
2023-05-29 16:22:34 +02:00
CMS.init({ config });
2023-02-11 20:15:36 +01:00
// preview templates
2023-01-14 17:31:54 +01:00
CMS.registerPreviewTemplate("about-index", AboutPreview);
CMS.registerPreviewTemplate("blog", BlogPreview);
CMS.registerPreviewTemplate("wettbewerbe", ContestPreview);
CMS.registerPreviewTemplate("ganztagsangebote", GanztagPreview);
2023-05-29 16:22:34 +02:00
CMS.registerPreviewTemplate("kontakt", KontaktPreview);
CMS.registerPreviewTemplate("termine", EventPreview);
CMS.registerPreviewTemplate("anmeldung-index", AnmeldungPreview);
2023-05-11 06:44:30 +02:00
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);
2023-02-11 20:15:36 +01:00
});
//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);
2023-05-11 06:44:30 +02:00
CMS.registerFieldPreview("chronikjahre", "topics", CountPreview);
["projektwoche", "superhaufen"].forEach((collection) =>
CMS.registerFieldPreview(collection, "tiles", CountPreview)
);
[
"forms",
"blog",
"cantorpreis",
"pages",
"ganztagsangebote",
"wettbewerbe",
"begabte",
"projektwoche",
2023-05-11 06:44:30 +02:00
"chronikjahre",
"abiturienten",
"superhaufen",
"cantorfora",
"chronikseiten",
].forEach((collection) =>
2023-04-20 07:51:28 +02:00
CMS.registerFieldPreview(collection, "draft", DraftPreview)
);
2023-05-29 16:22:34 +02:00
[
"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",
2023-05-29 16:22:34 +02:00
"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)
);
2023-05-29 16:22:34 +02:00
// access control
CMS.registerEventListener({
name: "login",
handler: ({ login }) => {
const adminUsers = [
2023-05-29 16:52:55 +02:00
"Tramus00",
2023-05-29 16:22:34 +02:00
"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 = "/";
}
},
});
2023-01-30 19:54:31 +01:00
</script>
2023-01-10 22:23:04 +01:00
</body>
2020-07-11 13:45:14 +02:00
</html>