1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #15637: Fix rendering of links from within embedded tables w/HTMX enabled (#15642)

* Add htmx_table to __all__

* Fix dropdown menu clipping

* Fix loading links from within embedded tables

* Fix rendering of object deletion warning
This commit is contained in:
Jeremy Stretch
2024-04-05 14:22:09 -04:00
committed by GitHub
parent ccca0580f7
commit d34f188d40
6 changed files with 6 additions and 6 deletions

View File

@ -381,7 +381,7 @@ class ObjectDeleteView(GetReturnURLMixin, BaseObjectView):
return self._handle_protected_objects(obj, e.restricted_objects, request, e)
# If this is an HTMX request, return only the rendered deletion form as modal content
if request.htmx:
if htmx_partial(request):
viewname = get_viewname(self.queryset.model, action='delete')
form_url = reverse(viewname, kwargs={'pk': obj.pk})
return render(request, 'htmx/delete_form.html', {

View File

@ -18,7 +18,7 @@ Context:
{% block content %}
<div class="modal" tabindex="-1" style="display: block; position: static">
<div class="modal-dialog">
<div class="modal-content" >
<div class="modal-content border-1 border-danger">
{% include 'htmx/delete_form.html' %}
</div>
</div>

View File

@ -1,9 +1,8 @@
{% load django_tables2 %}
<table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %}>
<table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %} hx-disinherit="hx-target hx-select hx-swap">
{% if table.show_header %}
<thead
hx-target="closest .htmx-container"
hx-disinherit="hx-select hx-swap"
{% if not table.embedded %} hx-push-url="true"{% endif %}
>
<tr>

View File

@ -10,4 +10,4 @@ def htmx_partial(request):
Determines whether to render partial (versus complete) HTML content
in response to an HTMX request, based on the target element.
"""
return request.htmx and request.htmx.target != PAGE_CONTAINER_ID
return request.htmx and request.htmx.target and request.htmx.target != PAGE_CONTAINER_ID

View File

@ -1,4 +1,4 @@
<div class="card-body htmx-container table-responsive p-0"
<div class="htmx-container table-responsive"
hx-get="{% url viewname %}{% if url_params %}?{{ url_params.urlencode }}{% endif %}"
hx-target="this"
hx-trigger="load" hx-select="table" hx-swap="innerHTML"

View File

@ -8,6 +8,7 @@ __all__ = (
'checkmark',
'copy_content',
'customfield_value',
'htmx_table',
'formaction',
'tag',
)