Compare commits

...

3 Commits

Author SHA1 Message Date
Jürgen Mummert 3176e6e414 Fix FilePond label interaction CSS conflicts 2026-03-01 11:52:43 +01:00
Jürgen Mummert 83c632f2dc Tune FilePond panel aspect ratios 2026-03-01 11:34:24 +01:00
Jürgen Mummert 15a93466b6 Adjust FilePond sizing and upload resize rules 2026-03-01 10:56:38 +01:00
2 changed files with 122 additions and 0 deletions
@@ -10,11 +10,40 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/themes/airbnb.css">
<link rel="stylesheet" href="https://unpkg.com/filepond/dist/filepond.min.css">
<link rel="stylesheet" href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css">
<style>
.module-event-edit .filepond--root {
width: 400px;
height: 600px;
}
.module-event-edit .filepond--root .filepond--drop-label {
height: 100%;
inset: 0;
}
.module-event-edit .filepond--root .filepond--drop-label label {
display: block;
width: auto;
float: none;
margin: 0;
padding: 0;
text-align: center;
font-weight: inherit;
}
.module-event-edit .filepond--root .filepond--drop-label,
.module-event-edit .filepond--root .filepond--drop-label label,
.module-event-edit .filepond--root .filepond--file-action-button {
pointer-events: auto;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/choices.js/public/assets/scripts/choices.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script src="https://cdn.jsdelivr.net/npm/flatpickr/dist/l10n/de.js"></script>
<script src="https://unpkg.com/filepond/dist/filepond.min.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-resize/dist/filepond-plugin-image-resize.min.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-transform/dist/filepond-plugin-image-transform.min.js"></script>
{{ form_start(form, { action: app.request.uri, attr: { 'aria-live': 'polite' } }) }}
<input type="hidden" name="REQUEST_TOKEN" value="{{ requestToken }}">
@@ -212,14 +241,46 @@
if (typeof window.FilePondPluginImagePreview !== 'undefined') {
window.FilePond.registerPlugin(window.FilePondPluginImagePreview);
}
if (typeof window.FilePondPluginImageResize !== 'undefined') {
window.FilePond.registerPlugin(window.FilePondPluginImageResize);
}
if (typeof window.FilePondPluginImageTransform !== 'undefined') {
window.FilePond.registerPlugin(window.FilePondPluginImageTransform);
}
const filePondOptions = {
instantUpload: false,
storeAsFile: true,
allowMultiple: false,
allowReplace: true,
stylePanelAspectRatio: 0.6666667,
styleItemPanelAspectRatio: 0.6666667,
credits: false,
acceptedFileTypes: ['image/*'],
allowImageResize: true,
imageResizeUpscale: false,
allowImageTransform: true,
onaddfile: function (error, fileItem) {
if (error || !fileItem || typeof fileItem.setMetadata !== 'function') {
return;
}
const fileType = fileItem.fileType || (fileItem.file && fileItem.file.type) || '';
if (fileType === 'image/svg+xml') {
fileItem.setMetadata('resize', null);
return;
}
fileItem.setMetadata('resize', {
mode: 'contain',
upscale: false,
size: {
width: 2000,
height: 2000
}
});
},
labelIdle: 'Bild hierher ziehen oder <span class="filepond--label-action">durchsuchen</span>'
};
@@ -8,9 +8,38 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/choices.min.css">
<link rel="stylesheet" href="https://unpkg.com/filepond/dist/filepond.min.css">
<link rel="stylesheet" href="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css">
<style>
.module-organization-edit .filepond--root {
width: 400px;
height: 400px;
}
.module-organization-edit .filepond--root .filepond--drop-label {
height: 100%;
inset: 0;
}
.module-organization-edit .filepond--root .filepond--drop-label label {
display: block;
width: auto;
float: none;
margin: 0;
padding: 0;
text-align: center;
font-weight: inherit;
}
.module-organization-edit .filepond--root .filepond--drop-label,
.module-organization-edit .filepond--root .filepond--drop-label label,
.module-organization-edit .filepond--root .filepond--file-action-button {
pointer-events: auto;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/choices.js/public/assets/scripts/choices.min.js"></script>
<script src="https://unpkg.com/filepond/dist/filepond.min.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-resize/dist/filepond-plugin-image-resize.min.js"></script>
<script src="https://unpkg.com/filepond-plugin-image-transform/dist/filepond-plugin-image-transform.min.js"></script>
{{ form_start(form, { attr: { 'aria-live': 'polite' } }) }}
<input type="hidden" name="REQUEST_TOKEN" value="{{ requestToken }}">
@@ -73,14 +102,46 @@
if (typeof window.FilePondPluginImagePreview !== 'undefined') {
window.FilePond.registerPlugin(window.FilePondPluginImagePreview);
}
if (typeof window.FilePondPluginImageResize !== 'undefined') {
window.FilePond.registerPlugin(window.FilePondPluginImageResize);
}
if (typeof window.FilePondPluginImageTransform !== 'undefined') {
window.FilePond.registerPlugin(window.FilePondPluginImageTransform);
}
const filePondOptions = {
instantUpload: false,
storeAsFile: true,
allowMultiple: false,
allowReplace: true,
stylePanelAspectRatio: 1,
styleItemPanelAspectRatio: 1,
credits: false,
acceptedFileTypes: ['image/*'],
allowImageResize: true,
imageResizeUpscale: false,
allowImageTransform: true,
onaddfile: function (error, fileItem) {
if (error || !fileItem || typeof fileItem.setMetadata !== 'function') {
return;
}
const fileType = fileItem.fileType || (fileItem.file && fileItem.file.type) || '';
if (fileType === 'image/svg+xml') {
fileItem.setMetadata('resize', null);
return;
}
fileItem.setMetadata('resize', {
mode: 'contain',
upscale: false,
size: {
width: 800,
height: 800
}
});
},
labelIdle: 'Logo hierher ziehen oder <span class="filepond--label-action">durchsuchen</span>'
};