-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update approvals list filters ui
The approval expiry field value for ALL changed from "0" to "". That allows the JS for `has-selected-item` to identify the “empty” option. It also allowed simplifying the form.
- Loading branch information
1 parent
18bd521
commit 48b94a3
Showing
13 changed files
with
142 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
htmx.onLoad((target) => { | ||
function toggleHasSelectedItem() { | ||
const dropdown = this.closest('.dropdown'); | ||
this.classList.toggle('has-selected-item', dropdown.querySelector('input:checked:not([value=""])')); | ||
} | ||
target.querySelectorAll('.btn-dropdown-filter.dropdown-toggle').forEach((dropdownFilter) => { | ||
dropdownFilter.addEventListener('hide.bs.dropdown', toggleHasSelectedItem); | ||
toggleHasSelectedItem.call(dropdownFilter); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
itou/templates/approvals/includes/approvals_filters/reset.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% load str_filters %} | ||
|
||
<div class="ms-md-auto" id="approvals-list-filter-counter"{% if request.htmx %} hx-swap-oob="true"{% endif %}> | ||
{% if filters_counter > 0 %} | ||
<a href="{% url 'approvals:list' %}" | ||
class="btn btn-ico btn-dropdown-filter" | ||
aria-label="Réinitialiser le{{ filters_counter|pluralizefr }} filtre{{ filters_counter|pluralizefr }} actif{{ filters_counter|pluralizefr }}"> | ||
<i class="ri-eraser-line font-weight-bold" aria-hidden="true"></i> | ||
<span>Effacer tout</span> | ||
</a> | ||
{% endif %} | ||
</div> |
18 changes: 10 additions & 8 deletions
18
itou/templates/approvals/includes/approvals_filters/status.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
{% load django_bootstrap5 %} | ||
|
||
<fieldset> | ||
<legend>Statut du PASS IAE</legend> | ||
<ul class="list-unstyled"> | ||
<li>{% bootstrap_field filters_form.status_valid wrapper_class="" %}</li> | ||
<li>{% bootstrap_field filters_form.status_suspended wrapper_class="" %}</li> | ||
<li>{% bootstrap_field filters_form.status_future wrapper_class="" %}</li> | ||
<li>{% bootstrap_field filters_form.status_expired wrapper_class="" %}</li> | ||
<div class="dropdown"> | ||
<button type="button" class="btn btn-dropdown-filter dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"> | ||
Statut | ||
</button> | ||
<ul class="dropdown-menu"> | ||
<li>{% bootstrap_field filters_form.status_valid wrapper_class="dropdown-item" %}</li> | ||
<li>{% bootstrap_field filters_form.status_suspended wrapper_class="dropdown-item" %}</li> | ||
<li>{% bootstrap_field filters_form.status_future wrapper_class="dropdown-item" %}</li> | ||
<li>{% bootstrap_field filters_form.status_expired wrapper_class="dropdown-item" %}</li> | ||
</ul> | ||
</fieldset> | ||
</div> |
23 changes: 17 additions & 6 deletions
23
itou/templates/approvals/includes/approvals_filters/users.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
{% load django_bootstrap5 %} | ||
|
||
<fieldset> | ||
<legend>Nom du salarié</legend> | ||
{% bootstrap_field filters_form.users layout="inline" %} | ||
</fieldset> | ||
<div class="dropdown"> | ||
<button type="button" class="btn btn-dropdown-filter dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"> | ||
Fin du parcours en IAE | ||
</button> | ||
<ul class="dropdown-menu"> | ||
{% for choice in filters_form.expiry %} | ||
<li> | ||
<div class="dropdown-item"> | ||
<div class="form-check"> | ||
<input class="form-check-input" type="radio" name="{{ choice.data.name }}" id="{{ choice.id_for_label }}" value="{{ choice.data.value }}"{% if choice.data.selected %} checked="checked"{% endif %}> | ||
<label class="form-check-label" for="{{ choice.id_for_label }}">{{ choice.data.label }}</label> | ||
</div> | ||
</div> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% load str_filters %} | ||
|
||
<h3 class="h4 mb-0" id="approvals-list-count"{% if request.htmx %} hx-swap-oob="true"{% endif %}> | ||
{% with paginator.count as counter %}<strong>{{ counter }} résultat{{ counter|pluralizefr }}</strong>{% endwith %} | ||
</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% load str_filters %} | ||
|
||
<div class="ms-md-auto" id="approvals-list-filter-counter"{% if request.htmx %} hx-swap-oob="true"{% endif %}> | ||
{% if filters_counter > 0 %} | ||
<a href="{% url 'approvals:list' %}" | ||
class="btn btn-ico btn-dropdown-filter" | ||
aria-label="Réinitialiser le{{ filters_counter|pluralizefr }} filtre{{ filters_counter|pluralizefr }} actif{{ filters_counter|pluralizefr }}"> | ||
<i class="ri-eraser-line font-weight-bold" aria-hidden="true"></i> | ||
<span>Effacer tout</span> | ||
</a> | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters