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-dokumentation
@@ -211,7 +211,7 @@
- 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.]]>
@@ -303,7 +303,7 @@
- Adgangskoderne er ikke ens
+ Adgangskoderne er ikke ens.