This commit is contained in:
Denys Konovalov 2022-12-23 13:02:17 +01:00
parent 11dc665a61
commit e06db40278
2 changed files with 45 additions and 82 deletions

@ -243,7 +243,7 @@ collections:
- {label: "Titel", name: "name", widget: "string"} - {label: "Titel", name: "name", widget: "string"}
- {label: "Link", name: "URL", widget: "string"} - {label: "Link", name: "URL", widget: "string"}
- label: "Sprachen" - label: "Sprachen"
name: "Languages" name: "languages"
widget: "object" widget: "object"
collapsed: true collapsed: true
fields: fields:
@ -352,26 +352,6 @@ collections:
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false} - {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"} - {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false} - {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- name: "impressum"
label: "Impressum"
file: "content/german/impressum/index.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown"}
- name: "datenschutz"
label: "Datenschutz"
file: "content/german/datenschutz/index.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown"}
- name: "wettbewerbe-index" - name: "wettbewerbe-index"
label: "Wettbewerbe" label: "Wettbewerbe"
file: "content/german/wettbewerbe/_index.md" file: "content/german/wettbewerbe/_index.md"
@ -388,39 +368,6 @@ collections:
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false} - {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"} - {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false} - {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- name: "schuelervertretung-index"
label: "Schülervertretung"
file: "content/german/schuelervertretung/index.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown", required: false}
- name: "schuelerrat-geschaeftsordnung"
label: "Geschäftsordnung der Schülervertretung"
file: "content/german/schuelervertretung/geschaeftsordnung.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown", required: false}
- name: "bibo"
label: "Schulbibliothek"
file: "content/german/bibo/index.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown", required: false}
- name: "abiturienten" - name: "abiturienten"
label: "Abiturienten" label: "Abiturienten"
file: "content/german/abiturienten/_index.md" file: "content/german/abiturienten/_index.md"
@ -439,28 +386,6 @@ collections:
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"} - {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false} - {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- {label: "Text", name: "body", widget: "markdown", required: false} - {label: "Text", name: "body", widget: "markdown", required: false}
- name: "elternvertretung-index"
label: "Elternvertretung"
file: "content/german/elternvertretung/index.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown", required: false}
- name: "jia-index"
label: "Junior-Ingenieur-Akademie"
file: "content/german/jia/index.md"
fields:
- {label: "Titel", name: "title", widget: "string"}
- {label: "Entwurf", name: "draft", widget: "boolean", default: false, required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- {label: "Type", name: "type", widget: "hidden", default: "pages"}
- {label: "Type", name: "layout", widget: "hidden", default: "single.html"}
- {label: "Text", name: "body", widget: "markdown", required: false}
- name: "pages" - name: "pages"
icon: "page" icon: "page"
label: "Zusatzseiten" label: "Zusatzseiten"
@ -480,7 +405,7 @@ collections:
- {label: "Layout", name: "layout", widget: "hidden", default: "single.html"} - {label: "Layout", name: "layout", widget: "hidden", default: "single.html"}
- label: "Aliase" - label: "Aliase"
name: "aliases" name: "aliases"
widget: "string" widget: "categories"
required: false required: false
- {label: "Text", name: "body", widget: "markdown", required: false} - {label: "Text", name: "body", widget: "markdown", required: false}
- name: "author" - name: "author"
@ -552,12 +477,12 @@ collections:
name: "categories" name: "categories"
widget: "list" widget: "list"
required: false required: false
field: {label: "Kategorie", name: "category", widget: "string"} field: {label: "Kategorie", name: "category", widget: "array"}
- label: "Tags" - label: "Tags"
name: "tags" name: "tags"
widget: "list" widget: "list"
required: false required: false
field: {label: "Tag", name: "tag", widget: "string"} field: {label: "Tag", name: "tag", widget: "array"}
- {label: "Type", name: "type", widget: "hidden", default: "post"} - {label: "Type", name: "type", widget: "hidden", default: "post"}
- {label: "Text", name: "body", widget: "markdown"} - {label: "Text", name: "body", widget: "markdown"}
- name: "forms" - name: "forms"

@ -39,7 +39,7 @@
CMS.registerShortcode('gallery', { CMS.registerShortcode('gallery', {
label: 'Gallery', label: 'Gallery',
openTag: '{{< ', openTag: '{{< ',
closeTag: ' >}}', closeTag: ' />}}',
separator: ' ', separator: ' ',
toProps: args => { toProps: args => {
if (args.length > 0) { if (args.length > 0) {
@ -66,8 +66,8 @@
}, },
preview: ({ dir }) => { preview: ({ dir }) => {
return h('div', {"className": "row", "style": { border: "1px solid #ccc", borderRadius: "16px", padding: "10px" }}, return h('div', {"className": "row", "style": { border: "1px solid #ccc", borderRadius: "16px", padding: "10px" }},
h('b', {}, "Gallerie-Ordner: "), h('b', {"style": { marginRight: "5px" }}, "Gallerie-Ordner:"),
h('span', {}, dir)); h('code', {}, dir));
}, },
}); });
CMS.registerShortcode('load-photoswipe', { CMS.registerShortcode('load-photoswipe', {
@ -87,6 +87,44 @@
}, },
}); });
</script>
<script>
const CategoriesControl = ({ label, value, field, onChange }) => {
const separator = useMemo(() => field.separator ?? ', ', [field.separator]);
const handleChange = useCallback((e) => {
onChange(e.target.value.split(separator).map(e => e.trim()));
}, [separator, onChange]);
return h('div', {},
h('label', { for: 'inputId' }, label),
h('input', {
id: 'inputId',
type: 'text',
value: value ? value.join(separator) : '',
onChange: this.handleChange,
})
);
};
const CategoriesPreview = ({ value }) => {
return h(
'ul',
{},
value.map(function (val, index) {
return h('li', { key: index }, val);
}),
);
};
const schema = {
properties: {
separator: { type: 'string' },
},
};
CMS.registerWidget('categories', CategoriesControl, CategoriesPreview, schema);
</script> </script>
<script> <script>
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/bootstrap/bootstrap.min.css"); CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/bootstrap/bootstrap.min.css");