diff --git a/CHANGELOG.md b/CHANGELOG.md index 76ea541..a001220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ See [keep a changelog](https://keepachangelog.com/en/1.0.0/) for information abo ## [Unreleased] +- [PR-34](https://github.com/itk-dev/aapodwalk_api/pull/34) + UI improvements - [PR-33](https://github.com/itk-dev/aapodwalk_api/pull/33) Security update - [PR-32](https://github.com/itk-dev/aapodwalk_api/pull/32) diff --git a/assets/admin.js b/assets/admin.js index 31522a7..4471a8f 100644 --- a/assets/admin.js +++ b/assets/admin.js @@ -81,4 +81,19 @@ window.addEventListener("load", () => { } } }); + + // Open accordions with errors on submit. + document.addEventListener("ea.form.error", (event) => { + const { page, form } = event.detail; + const elements = form.querySelectorAll(".accordion-item .has-error"); + for (const el of elements) { + const item = el.closest(".accordion-item"); + const button = item?.querySelector(".accordion-header button"); + const contents = item?.querySelector(".accordion-collapse"); + if (button && contents) { + button.classList.remove("collapsed"); + contents.classList.add("show"); + } + } + }); }); diff --git a/src/Form/LocationType.php b/src/Form/LocationType.php index 0386838..173d655 100644 --- a/src/Form/LocationType.php +++ b/src/Form/LocationType.php @@ -27,7 +27,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void public function implodeCoordinates(?array $coordinates): string { - return implode(', ', $coordinates ?? []); + // Separate non-empty values with comma. + return implode(', ', array_filter($coordinates ?? [])); } public function explodeCoordinates(string $coordinates): array diff --git a/translations/admin+intl-icu.da.xlf b/translations/admin+intl-icu.da.xlf index 5fc2dff..8fb52ab 100644 --- a/translations/admin+intl-icu.da.xlf +++ b/translations/admin+intl-icu.da.xlf @@ -115,7 +115,7 @@ API documentation - API-documentation + API-dokumentation Administration @@ -211,7 +211,7 @@ Enter a location on the form <code>lat, lng</code>, e.g. <code>56.153244272970866, 10.213798100000005</code>. <strong>Notice</strong>: the two numbers must always be separated by a comma and use dot as decimal separator.<br>Hint: Open <a href="https://www.google.com/maps" target="_blank">Google Maps</a> and “right” click on the map to get the coordinates. - breddegrad, længdegrad, fx. 56.153244272970866, 10.213798100000005. Bemærk: de to tal skal altid adskilles af et komma og skal bruge punktum som decimalseparator.
Tip: Åbn Google Maps and højreklik på kortet for at få koordinaterne.]]>
+ breddegrad, længdegrad, fx. 56.153244272970866, 10.213798100000005. Bemærk: de to tal skal altid adskilles af et komma og skal bruge punktum som decimalseparator.
Tip: Åbn Google Maps og højreklik på kortet for at få koordinaterne.]]>
The total duration of the route, i.e. the total duration of audio tracks in the route plus the time needed for moving along the route. @@ -303,7 +303,7 @@ The password fields must match. - Adgangskoderne er ikke ens + Adgangskoderne er ikke ens. New password