mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-28 19:36:26 -06:00
Preliminary work on 9583.
This commit is contained in:
parent
e762755e80
commit
f7294f7087
@ -60,7 +60,7 @@ Context:
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{# Object list tab #}
|
{# Object list tab #}
|
||||||
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab" hx-include="#object-list thead select, #object-list input[type='search']">
|
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
|
||||||
|
|
||||||
{# Applied filters #}
|
{# Applied filters #}
|
||||||
{% if filter_form %}
|
{% if filter_form %}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<div class="col-auto d-print-none">
|
<div class="col-auto d-print-none">
|
||||||
<div class="input-group input-group-flat me-2 quicksearch">
|
<div class="input-group input-group-flat me-2 quicksearch">
|
||||||
<input type="search" results="5" name="q" id="quicksearch" class="form-control px-2 py-1" placeholder="Quick search"
|
<input type="search" results="5" name="q" id="quicksearch" class="form-control px-2 py-1" placeholder="Quick search"
|
||||||
hx-get="{{ request.full_path }}" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search" />
|
hx-get="" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search" />
|
||||||
<span class="input-group-text py-1">
|
<span class="input-group-text py-1">
|
||||||
<a href="#" id="quicksearch_clear" class="d-none text-secondary"><i class="mdi mdi-close-circle"></i></a>
|
<a href="#" id="quicksearch_clear" class="d-none text-secondary"><i class="mdi mdi-close-circle"></i></a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<i class="mdi mdi-filter-settings" style="font-size: 1.25rem;"> </i>
|
<i class="mdi mdi-filter-settings" style="font-size: 1.25rem;"> </i>
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropdown-menu-end">
|
<div class="dropdown-menu dropdown-menu-end">
|
||||||
{% render_filter_field form_field %}
|
{% render_filter_field form_field table=table request=request %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
@ -1,5 +1,6 @@
|
|||||||
from django import template
|
from django import template
|
||||||
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'getfield',
|
'getfield',
|
||||||
'getfilterfield',
|
'getfilterfield',
|
||||||
@ -10,6 +11,7 @@ __all__ = (
|
|||||||
'widget_type',
|
'widget_type',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from utilities.templatetags.helpers import querystring
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@ -68,13 +70,23 @@ def render_field(field, bulk_nullable=False, label=None):
|
|||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag('form_helpers/render_field.html')
|
@register.inclusion_tag('form_helpers/render_field.html')
|
||||||
def render_filter_field(field, bulk_nullable=False, label=None):
|
def render_filter_field(field, bulk_nullable=False, table=None, request=None):
|
||||||
"""
|
"""
|
||||||
Render a single form field from template
|
Render a single form field from template
|
||||||
"""
|
"""
|
||||||
|
url = ""
|
||||||
|
kwargs = {
|
||||||
|
field.name: None
|
||||||
|
}
|
||||||
|
if request and table.htmx_url:
|
||||||
|
url = table.htmx_url + querystring(request, **kwargs)
|
||||||
|
elif request:
|
||||||
|
url = querystring(request, **kwargs)
|
||||||
|
|
||||||
if hasattr(field.field, 'widget'):
|
if hasattr(field.field, 'widget'):
|
||||||
field.field.widget.attrs.update({
|
field.field.widget.attrs.update({
|
||||||
'hx-get': "",
|
'hx-get': url if url else '#',
|
||||||
|
'hx-push-url': "true",
|
||||||
'hx-target': '#object_list',
|
'hx-target': '#object_list',
|
||||||
'hx-trigger': 'hidden.bs.dropdown from:closest .dropdown'
|
'hx-trigger': 'hidden.bs.dropdown from:closest .dropdown'
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user