Skip to content

Commit

Permalink
Fixes #15641: Fix adding/removing filters on advanced object selector…
Browse files Browse the repository at this point in the history
… widget
  • Loading branch information
jeremystretch committed Apr 19, 2024
1 parent 480b36d commit 2b0128d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions netbox/templates/htmx/object_selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ <h5 class="modal-title">{% trans "Select" %} {{ model|meta:"verbose_name"|better
<div class="col-3">
<div class="list-group list-group-flush">
{% for field in form.visible_fields %}
<a href="#" class="list-group-item list-group-item-action px-0 py-1" data-bs-toggle="collapse" data-bs-target="#checkmark{{ forloop.counter }}, #selector{{ forloop.counter }}">
<span id="checkmark{{ forloop.counter }}" class="collapse{% if forloop.counter < 3 or field.name in form.selector_fields %} show{% endif %}"><i class="mdi mdi-check-bold"></i></span>
<a href="#" class="list-group-item list-group-item-action px-0 py-1" data-bs-toggle="collapse" data-bs-target=".selector{{ forloop.counter }}">
<span class="collapse selector{{ forloop.counter }}{% if forloop.counter < 3 or field.name in form.selector_fields %} show{% endif %}"><i class="mdi mdi-check-bold"></i></span>
{{ field.label }}
</a>
{% endfor %}
Expand All @@ -21,7 +21,7 @@ <h5 class="modal-title">{% trans "Select" %} {{ model|meta:"verbose_name"|better
<input type="hidden" name="_search" value="true" />
<div class="tab-content p-1">
{% for field in form.visible_fields %}
<div class="collapse{% if field.name in form.selector_fields %} show{% endif %}" id="selector{{ forloop.counter }}">{% render_field field %}</div>
<div class="collapse selector{{ forloop.counter }}{% if field.name in form.selector_fields %} show{% endif %}">{% render_field field %}</div>
{% endfor %}
</div>
<div class="text-end">
Expand Down
10 changes: 4 additions & 6 deletions netbox/templates/htmx/object_selector_results.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<div class="list-group">
{% for object in results %}
<a href="#" class="list-group-item list-group-item-action" data-label="{{ object }}" data-value="{{ object.pk }}" data-bs-dismiss="modal">
<h6 class="mb-1">
{{ object }}
{% if object.status %}{% badge object.get_status_display bg_color=object.get_status_color %}{% endif %}
</h6>
<a href="#" class="list-group-item list-group-item-action p-2" data-label="{{ object }}" data-value="{{ object.pk }}" data-bs-dismiss="modal">
{{ object }}
{% if object.status %}{% badge object.get_status_display bg_color=object.get_status_color %}{% endif %}
{% if object.description %}
<small>{{ object.description }}</small>
<small class="d-block text-muted">{{ object.description }}</small>
{% endif %}
</a>
{% endfor %}
Expand Down

0 comments on commit 2b0128d

Please sign in to comment.