Merge branch 'master' into dev

This commit is contained in:
2024-01-03 14:37:16 +01:00
69 changed files with 1130 additions and 674 deletions

View File

@ -1,4 +1,4 @@
import { MarkdownProps } from "../props.js";
import { MarkdownProps, EditorProps } from "../props.js";
import { DraftBoolean, EnableBoolean } from "./widgets.js";
const ChronikjahreCollection = {
@ -13,11 +13,7 @@ const ChronikjahreCollection = {
field: "type",
value: "schulchronik",
},
create: true,
editor: {
preview: false,
size: "half",
},
...EditorProps,
summary_fields: ["title", "draft", "cantorpreisträger", "topics"],
sortable_fields: {
fields: ["title"],
@ -44,7 +40,20 @@ const ChronikjahreCollection = {
label: "Einleitung",
hint: "Text für die Jahreszahl",
required: false,
...MarkdownProps,
widget: "object",
fields: [
EnableBoolean,
{
name: "content",
label: "Text",
condition: {
field: "pretext.enable",
value: true,
},
required: false,
...MarkdownProps,
}
]
},
{
name: "topics",
@ -53,6 +62,7 @@ const ChronikjahreCollection = {
widget: "list",
required: false,
collapsed: true,
max: 4,
fields: [
{
name: "title",
@ -63,6 +73,10 @@ const ChronikjahreCollection = {
{
name: "content",
label: "Inhalt",
condition: {
field: "superhaufen.enable",
value: false,
},
required: false,
...MarkdownProps,
},
@ -80,6 +94,10 @@ const ChronikjahreCollection = {
collection: "superhaufen",
search_fields: ["title"],
value_field: "title",
condition: {
field: "superhaufen.enable",
value: true,
},
required: false,
collapsed: true,
},
@ -96,13 +114,6 @@ const ChronikjahreCollection = {
value_field: "name",
required: false,
},
{
name: "body",
label: "Text",
hint: "Erscheint zusätzlich zu den Kreativen Haufen",
required: false,
...MarkdownProps,
},
],
};

View File

@ -1,78 +1,79 @@
import { PageHeader } from "./components/index.js";
const ChronikPreview = ({ widgetFor, widgetsFor, entry, document, window }) => {
/*return [PageHeader,
h('section', {className: "section"},
h('div', {className: "container"},
h('div', {className: "row"},
h('div', {className: "col-12 mb-4 content"},
widgetsFor('topics').map(function(i, index) {
return h('div', {"id": i.data.id, className: "modal"},
h('div', {className: "modal-dialog modal-lg", "role": "document"},
h('div', {className: "modal-content"},
h('div', {className: "modal-header"},
h('h5', {className: "modal-title"}, i.data.title),
h('button', {className: "close", type: "button", "dataDismiss": "modal", "ariaLabel": "Close"},
h('span', {"ariaHidden": "true"}, '\u{00d7}')
)
),
h('div', {className: "modal-body"},
h('div', {className: "content"}, i.content)
)
)
)
);
}),
entry.data.pretext != "" && entry.data.pretext != null ? h('div', {"id": "pretext", className: "modal"},
h('div', {className: "modal-dialog modal-lg", "role": "document"},
h('div', {className: "modal-content"},
h('div', {className: "modal-header"},
h('h5', {className: "modal-title"}, entry.data.title),
h('button', {className: "close", type: "button", "dataDismiss": "modal", "ariaLabel": "Close"},
h('span', {"ariaHidden": "true"}, '\u{00d7}')
)
),
h('div', {className: "modal-body"},
h('div', {className: "content"}, widgetFor('pretext'))
)
)
)
) : null,
h('div', {"id": "wc-canvas"}),
() => {
var topics = [[entry.data.title, 100, "pretext"]];
widgetsFor('topics').map(function(i, index) {
topics.push([i.data.title, 40, i.data.id]);
});
var script = document.createElement('script');
var div = document.getElementById('sc-root');
div.appendChild(script);
WordCloud(
document.getElementById('wc-canvas'),
{
click: function (item) {
if (item[1] != 100 || (item[1] == 100 && item[2] == "pretext")) {
$('#' + item[2]).modal('show');
}
},
color: function (word, weight) {
return (weight === 100) ? '#ffbc3b' : '#1a1a37';
},
fontFamily: 'Fira Sans, serif',
fontWeight: 800,
list: topics,
shrinkToFit: true,
gridSize: 25,
rotateRatio: 0,
}
);
},
widgetFor('body')
)
)
)
return [
PageHeader(entry),
h(
"section",
{ className: "section" },
h(
"div",
{ className: "container" },
h(
"div",
{ className: "card-group" },
h(
"div",
{ className: "card d-flex flex-row flex-wrap" },
h("img", {
src: "https://cantorgymnasium.de/media/people/gcg.webp",
className: "rounded-circle object-cover m-3",
width: "128px",
height: "128px",
}),
h(
"div",
{ className: "flex-grow card-body min-w-0" },
h("h3", { className: "card-title" }, "Cantorpreisträger"),
h(
"p",
{ className: "h4 card-text" },
widgetFor("cantorpreisträger")
)
)
];*/
),
h(
"div",
{ className: "card d-flex flex-row flex-wrap-reverse" },
h(
"div",
{ className: "flex-grow card-body min-w-0" },
h(
"h3",
{ className: "card-title" },
"Abiturienten " + entry.data.title
),
h("p", { className: "h4 card-text" }, "Abiturdurchschnitt: 0.00")
),
h("img", {
src: "https://cantorgymnasium.de/media/people/gcg.webp",
className: "rounded-circle object-cover m-3",
width: "128px",
height: "128px",
})
)
),
h(
"div",
{ className: "kh-parent" },
h(
"div",
{ className: "kh-jahr h1" },
h("span", {}, entry.data.title)
),
widgetsFor("topics")
.sort((a, b) => b.data.title.length - a.data.title.length)
.map((topic, index) =>
h(
"div",
{ className: "kh h3", "data-id": `${index}` },
h("span", {}, topic.data.title)
)
)
)
)
),
];
};
export default ChronikPreview;

View File

@ -3,7 +3,7 @@ const PreviewStyles = [
"https://assets.cantorgymnasium.de/fonts/fira/fira.css",
"https://assets.cantorgymnasium.de/fonts/ubuntu/ubuntu.css",
"https://assets.cantorgymnasium.de/fonts/mdi/v7/css/materialdesignicons.min.css",
"https://cantorgymnasium.de/css/style.min.css",
"/css/style.min.css",
];
export default PreviewStyles;

View File

@ -1,4 +1,4 @@
import { Card, TextField } from "./components/index.js";
import { Card, TextField, Label } from "./components.js";
const AudioShortcode = {
label: "Audiodatei",
@ -33,24 +33,31 @@ const AudioShortcode = {
);
return Card([
TextField({
label: "Audiodatei",
value: src,
onChange: (event) => {
onChange({ src: event.target.value });
},
}),
Label("Audiodatei"),
h(
"span",
{ key: "audio-button", className: "CMS_WidgetDateTime_NowButton_root" },
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
{ className: "CMS_WidgetDateTime_inputs" },
TextField({
value: src,
onChange: (event) => {
onChange({ src: event.target.value });
},
"wählen"
}),
h(
"span",
{
key: "audio-button",
className: "CMS_WidgetDateTime_NowButton_root",
},
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
},
"wählen"
)
)
),
]);

View File

@ -1,4 +1,4 @@
import { Card, TextField } from "./components/index.js";
import { Card, TextField, Label } from "./components.js";
const CardShortcode = {
label: "Link-Karte",
@ -27,15 +27,15 @@ const CardShortcode = {
},
control: ({ title, link, onChange }) => {
return Card([
Label("Titel"),
TextField({
label: "Titel",
value: title,
onChange: (event) => {
onChange({ title: event.target.value.trimStart(), link });
},
}),
Label("Link"),
TextField({
label: "Link",
value: link,
onChange: (event) => {
onChange({ title, link: event.target.value });

View File

@ -0,0 +1,58 @@
const Card = (children, opts = { vertical: false }) =>
h(
"span",
{
className:
"CMS_Card_root CMS_Field_root CMS_WidgetString_root CMS_WidgetString_required CMS_Field_cursor-text CMS_WidgetMarkdown_Paragraph_root" +
(opts.vertical ? " flex-col" : ""),
},
h("span", { className: "CMS_Field_wrapper" }, children)
);
const Image = ({ assetSource, handleOpenMediaLibrary }) =>
h(
"span",
{ className: "CMS_WidgetFileImage_content" },
h(
"span",
{},
h("img", {
role: "presentation",
src: assetSource,
className: "CMS_Image_root",
})
),
h(
"span",
{ className: "CMS_WidgetFileImage_actions" },
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
},
"Bild auswählen"
)
)
);
const TextField = ({ value, onChange }) =>
h("input", {
className:
"MuiInput-input CMS_TextField_input CMS_WidgetString_input CMS_TextField_borderless CMS_Label_cursor-text",
type: "text",
value,
onChange,
});
const Label = (label) =>
h(
"label",
{
className: "CMS_Label_root CMS_Label_cursor-pointer",
},
label
);
export { Card, Image, TextField, Label };

View File

@ -1,12 +0,0 @@
const Card = (child, opts = { vertical: false }) =>
h(
"span",
{
className:
"CMS_Card_root CMS_Field_root CMS_WidgetString_root CMS_WidgetString_required CMS_Field_cursor-text CMS_WidgetMarkdown_Paragraph_root" +
(opts.vertical ? " flex-col" : ""),
},
child
);
export default Card;

View File

@ -1,40 +0,0 @@
const Image = ({ label, assetSource, handleOpenMediaLibrary }) =>
h(
"span",
{ className: "CMS_Field_wrapper" },
h(
"label",
{
className: "CMS_Label_root CMS_Label_cursor-pointer",
},
label
),
h(
"span",
{ className: "CMS_WidgetFileImage_content" },
h(
"span",
{},
h("img", {
role: "presentation",
src: assetSource,
className: "CMS_Image_root",
})
),
h(
"span",
{ className: "CMS_WidgetFileImage_actions" },
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
},
"Bild auswählen"
)
)
)
);
export default Image;

View File

@ -1,5 +0,0 @@
import Card from "./card.js";
import TextField from "./text-field.js";
import Image from "./image.js";
export { Card, TextField, Image };

View File

@ -1,21 +0,0 @@
const TextField = ({ label, value, onChange }) =>
h(
"span",
{ key: "text-" + label, className: "CMS_Field_wrapper" },
h(
"label",
{
className: "CMS_Label_root CMS_TextField_cursor-default",
},
label
),
h("input", {
className:
"MuiInput-input CMS_TextField_input CMS_WidgetString_input CMS_TextField_borderless CMS_Label_cursor-text",
type: "text",
value,
onChange,
})
);
export default TextField;

View File

@ -1,4 +1,4 @@
import { Card, TextField } from "./components/index.js";
import { Card, TextField, Label } from "./components.js";
const DownloadShortcode = {
label: "Download-Karte",
@ -39,24 +39,20 @@ const DownloadShortcode = {
);
return Card([
Label("Titel"),
TextField({
label: "Titel",
value: title,
onChange: (event) => {
onChange({ title: event.target.value.trimStart(), link });
},
}),
Label("Download-Link"),
h(
"span",
{
style: {
display: "flex",
"flex-direction": "row",
"align-items": "end",
},
class: "CMS_WidgetDateTime_inputs"
},
TextField({
label: "Download-Link",
value: link,
onChange: (event) => {
onChange({ title, link: event.target.value });

View File

@ -1,4 +1,4 @@
import { Card, TextField } from "./components/index.js";
import { Card, TextField, Label } from "./components.js";
const GalleryShortcode = {
label: "Bildergallerie",
@ -34,27 +34,31 @@ const GalleryShortcode = {
);
return Card([
TextField({
label: "Gallerie-Ordner",
value: dir,
onChange: (event) => {
onChange({ dir: event.target.value });
},
}),
Label("Galerie-Ordner"),
h(
"span",
{
key: "gallery-button",
className: "CMS_WidgetDateTime_NowButton_root",
},
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
{ className: "CMS_WidgetDateTime_inputs" },
TextField({
value: dir,
onChange: (event) => {
onChange({ dir: event.target.value });
},
"wählen"
}),
h(
"span",
{
key: "gallery-button",
className: "CMS_WidgetDateTime_NowButton_root",
},
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
},
"wählen"
)
)
),
]);

View File

@ -1,4 +1,4 @@
import { Card, Image } from "./components/index.js";
import { Card, Image, Label } from "./components.js";
import { md5 } from "../previews/page-previews/components/index.js";
const ImageShortcode = {
@ -36,13 +36,13 @@ const ImageShortcode = {
);
const assetSource = useMediaAsset(src, collection, field, entry);
return Card(
return Card([
Label("Bild"),
Image({
label: "Bild",
assetSource,
handleOpenMediaLibrary,
})
);
}),
]);
},
preview: ({ src }) => {
return h(

View File

@ -1,4 +1,4 @@
import { Card, TextField } from "./components/index.js";
import { Card, TextField, Label } from "./components.js";
const SliderShortcode = {
label: "Bilderkarussell",
@ -34,27 +34,31 @@ const SliderShortcode = {
);
return Card([
TextField({
label: "Bilderkarussell",
value: dir,
onChange: (event) => {
onChange({ dir: event.target.value });
},
}),
Label("Bilderkarussell"),
h(
"span",
{
key: "slider-button",
className: "CMS_WidgetDateTime_NowButton_root",
},
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
{ className: "CMS_WidgetDateTime_inputs" },
TextField({
value: dir,
onChange: (event) => {
onChange({ dir: event.target.value });
},
"wählen"
}),
h(
"span",
{
key: "slider-button",
className: "CMS_WidgetDateTime_NowButton_root",
},
h(
"button",
{
type: "button",
onClick: handleOpenMediaLibrary,
className: "CMS_Button_root CMS_Button_outlined-primary",
},
"wählen"
)
)
),
]);

View File

@ -1,4 +1,4 @@
import { Card, TextField } from "./components/index.js";
import { Card, TextField, Label } from "./components.js";
const YoutubeShortcode = {
label: "YouTube-Video",
@ -18,8 +18,8 @@ const YoutubeShortcode = {
control: ({ src, onChange }) => {
return Card(
[
Label("YouTUbe-Video"),
TextField({
label: "YouTube-Video-ID",
value: src,
onChange: (event) => {
onChange({ src: event.target.value });