cms optimizations

This commit is contained in:
Denys Konovalov 2023-01-27 18:41:08 +01:00
parent 012950813b
commit 22314221d0
2 changed files with 8 additions and 81 deletions

@ -5,9 +5,9 @@ backend:
api_root: https://git.cantorgymnasium.de/api/v1 api_root: https://git.cantorgymnasium.de/api/v1
base_url: https://oauth.cantorgymnasium.de base_url: https://oauth.cantorgymnasium.de
commit_messages: commit_messages:
create: "{{slug}} in {{collection}} erstellt" create: "{{collection}} {{slug}} erstellt"
update: "{{slug}} in {{collection}} aktualisiert" update: "{{collection}} {{slug}} aktualisiert"
delete: "{{slug}} aus {{collection}} gelöscht" delete: "{{collection}} {{slug}} gelöscht"
uploadMedia: "{{path}} hochgeladen" uploadMedia: "{{path}} hochgeladen"
deleteMedia: "{{path}} gelöscht" deleteMedia: "{{path}} gelöscht"
@ -19,6 +19,11 @@ site_url: https://cantorgymnasium.de
display_url: https://cantorgymnasium.de display_url: https://cantorgymnasium.de
locale: "de" locale: "de"
slug:
encoding: "ascii"
clean_accents: true
sanitize_replacement: "-"
show_preview_links: false show_preview_links: false
collections: collections:

@ -12,7 +12,6 @@
font-family: sans-serif; font-family: sans-serif;
} }
</style> </style>
<!-- Include the script that builds the page and powers Static CMS -->
<script src="https://cdn.jsdelivr.net/npm/@staticcms/app@^1.1.3/dist/static-cms-app.js"></script> <script src="https://cdn.jsdelivr.net/npm/@staticcms/app@^1.1.3/dist/static-cms-app.js"></script>
<script> <script>
CMS.init(); CMS.init();
@ -91,33 +90,6 @@
toArgs: ({ src }) => { toArgs: ({ src }) => {
return [`src=\"${src}\"`]; return [`src=\"${src}\"`];
}, },
/*control: ({ src, onChange, controlProps: { field, collection, entry } }) => {
const controlID = useUUID();
const handleOnChange = (newSrc) => {
onChange(newSrc);
}
const handleOpenMediaLibrary = useMediaInsert(
src,
{ field, controlID },
handleOnChange,
);
const assetSource = useMediaAsset(src, collection, field, entry);
return h('span', {}, [
h('button', {
key: 'control-button',
onClick: handleOpenMediaLibrary,
}, 'Click to open media library'),
h(
'img',
{
key: 'control-preview',
src: assetSource,
},
'',
),
]);
},*/
control: ({ src, onChange }) => { control: ({ src, onChange }) => {
return h('div', {"className": "row", "style": { border: "1px solid #868686", borderRadius: "16px", padding: "10px" }}, return h('div', {"className": "row", "style": { border: "1px solid #868686", borderRadius: "16px", padding: "10px" }},
h('b', {"style": {width: "30%", fontFamily: "sans-serif", margin: "10px"}}, "Bild-Pfad:"), h('b', {"style": {width: "30%", fontFamily: "sans-serif", margin: "10px"}}, "Bild-Pfad:"),
@ -338,59 +310,9 @@
); );
}, },
}); });
CMS.registerShortcode('load-photoswipe', {
label: 'Gallerie-Servicemodul',
openTag: '{{< ',
closeTag: ' >}}',
separator: '',
control: () => {
return h('div', {"style": { border: "1px solid #868686", borderRadius: "8px", padding: "10px" }},
h('b', {"style": {fontFamily: "sans-serif", margin: "10px"}}, "Gallerie-Servicemodul"));
},
});
</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");
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/slick/slick.css");
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/animate/animate.min.css");
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/venobox/venobox.css");
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/fontawesome/css/all.css"); CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/fontawesome/css/all.css");
CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/fira/fira.css"); CMS.registerPreviewStyle("https://cantorgymnasium.de/plugins/fira/fira.css");
CMS.registerPreviewStyle("https://cantorgymnasium.de/scss/style.css"); CMS.registerPreviewStyle("https://cantorgymnasium.de/scss/style.css");