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

@ -243,7 +243,7 @@ collections:
- {label: "Titel", name: "name", widget: "string"}
- {label: "Link", name: "URL", widget: "string"}
- label: "Sprachen"
name: "Languages"
name: "languages"
widget: "object"
collapsed: true
fields:
@ -352,26 +352,6 @@ collections:
- {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}
- 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"
label: "Wettbewerbe"
file: "content/german/wettbewerbe/_index.md"
@ -388,39 +368,6 @@ collections:
- {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}
- 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"
label: "Abiturienten"
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: "Metabeschreibung", name: "description", widget: "text", 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"
icon: "page"
label: "Zusatzseiten"
@ -480,7 +405,7 @@ collections:
- {label: "Layout", name: "layout", widget: "hidden", default: "single.html"}
- label: "Aliase"
name: "aliases"
widget: "string"
widget: "categories"
required: false
- {label: "Text", name: "body", widget: "markdown", required: false}
- name: "author"
@ -552,12 +477,12 @@ collections:
name: "categories"
widget: "list"
required: false
field: {label: "Kategorie", name: "category", widget: "string"}
field: {label: "Kategorie", name: "category", widget: "array"}
- label: "Tags"
name: "tags"
widget: "list"
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: "Text", name: "body", widget: "markdown"}
- name: "forms"

@ -39,7 +39,7 @@
CMS.registerShortcode('gallery', {
label: 'Gallery',
openTag: '{{< ',
closeTag: ' >}}',
closeTag: ' />}}',
separator: ' ',
toProps: args => {
if (args.length > 0) {
@ -66,8 +66,8 @@
},
preview: ({ dir }) => {
return h('div', {"className": "row", "style": { border: "1px solid #ccc", borderRadius: "16px", padding: "10px" }},
h('b', {}, "Gallerie-Ordner: "),
h('span', {}, dir));
h('b', {"style": { marginRight: "5px" }}, "Gallerie-Ordner:"),
h('code', {}, dir));
},
});
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>
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/bootstrap/bootstrap.min.css");