Skip to content

Commit

Permalink
Merge pull request #34 from itk-dev/feature/ui-improvements
Browse files Browse the repository at this point in the history
UI improvements
  • Loading branch information
rimi-itk authored Dec 17, 2024
2 parents 580d305 + ba55436 commit 1652bcd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions assets/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
});
});
3 changes: 2 additions & 1 deletion src/Form/LocationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions translations/admin+intl-icu.da.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
</trans-unit>
<trans-unit id="Q4p_Gmi" resname="API documentation">
<source>API documentation</source>
<target state="translated">API-documentation</target>
<target state="translated">API-dokumentation</target>
</trans-unit>
<trans-unit id="mpHDX6N" resname="Administration">
<source>Administration</source>
Expand Down Expand Up @@ -211,7 +211,7 @@
</trans-unit>
<trans-unit id="XkthfIE" resname="Enter a location on the form &lt;code&gt;lat, lng&lt;/code&gt;, e.g. &lt;code&gt;56.153244272970866, 10.213798100000005&lt;/code&gt;. &lt;strong&gt;Notice&lt;/strong&gt;: the two numbers must always be separated by a comma and use dot as decimal separator.&lt;br&gt;Hint: Open &lt;a href=&quot;https://www.google.com/maps&quot; target=&quot;_blank&quot;&gt;Google Maps&lt;/a&gt; and “right” click on the map to get the coordinates.">
<source>Enter a location on the form &lt;code&gt;lat, lng&lt;/code&gt;, e.g. &lt;code&gt;56.153244272970866, 10.213798100000005&lt;/code&gt;. &lt;strong&gt;Notice&lt;/strong&gt;: the two numbers must always be separated by a comma and use dot as decimal separator.&lt;br&gt;Hint: Open &lt;a href="https://www.google.com/maps" target="_blank"&gt;Google Maps&lt;/a&gt; and “right” click on the map to get the coordinates.</source>
<target state="translated"><![CDATA[Indtast en lokation på formen <code>breddegrad, længdegrad</code>, fx. <code>56.153244272970866, 10.213798100000005</code>. <strong>Bemærk</strong>: de to tal skal altid adskilles af et komma og skal bruge punktum som decimalseparator.<br>Tip: Åbn <a href="https://www.google.com/maps" target="_blank">Google Maps</a> and højreklik på kortet for at få koordinaterne.]]></target>
<target state="translated"><![CDATA[Indtast en lokation på formen <code>breddegrad, længdegrad</code>, fx. <code>56.153244272970866, 10.213798100000005</code>. <strong>Bemærk</strong>: de to tal skal altid adskilles af et komma og skal bruge punktum som decimalseparator.<br>Tip: Åbn <a href="https://www.google.com/maps" target="_blank">Google Maps</a> og højreklik på kortet for at få koordinaterne.]]></target>
</trans-unit>
<trans-unit id="p.sAfxC" resname="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.">
<source>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.</source>
Expand Down Expand Up @@ -303,7 +303,7 @@
</trans-unit>
<trans-unit id="_z4el3Z" resname="The password fields must match.">
<source>The password fields must match.</source>
<target state="translated">Adgangskoderne er ikke ens</target>
<target state="translated">Adgangskoderne er ikke ens.</target>
</trans-unit>
<trans-unit id="Zm.jZiK" resname="New password">
<source>New password</source>
Expand Down

0 comments on commit 1652bcd

Please sign in to comment.