Skip to content

Commit

Permalink
Make user menu selectors more reusable (#200)
Browse files Browse the repository at this point in the history
* Drop id attribute in theme name tag

Makes it possible to include several theme selectors on the same page

* Drop id attribute in datetime name tag

* Drop redundant attributes on datetime selector

The whole view is refreshed on datetime format update
  • Loading branch information
podliashanyk authored Oct 24, 2024
1 parent 82ea6af commit b781dff
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<details>
<summary>
Date format
<span id="dateformat-badge" class="badge badge-primary">{{ datetime_format_name }}</span>
<span class="badge badge-primary">{{ datetime_format_name }}</span>
</summary>
<ul class="max-h-64 overflow-y-scroll">
<li
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
name="dateformat"
hx-post="{% url 'htmx:change-dateformat' %}"
hx-trigger="change"
hx-swap="textContent"
hx-target="#dateformat-badge"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
/>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/argus_htmx/templates/htmx/themes/theme_dropdown.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<details>
<summary>
Theme
<span id="theme-badge" class="badge badge-primary">{{ theme }}</span>
<span class="badge badge-primary">{{ theme }}</span>
</summary>
<ul class="max-h-64 overflow-y-scroll">
<li
Expand Down
2 changes: 1 addition & 1 deletion src/argus_htmx/templates/htmx/themes/theme_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
hx-post="{% url 'htmx:change-theme' %}"
hx-trigger="change"
hx-swap="textContent"
hx-target="#theme-badge"
hx-target="previous summary .badge"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
/>
</li>
Expand Down

0 comments on commit b781dff

Please sign in to comment.