mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* 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:
@ -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', {
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -8,6 +8,7 @@ __all__ = (
|
||||
'checkmark',
|
||||
'copy_content',
|
||||
'customfield_value',
|
||||
'htmx_table',
|
||||
'formaction',
|
||||
'tag',
|
||||
)
|
||||
|
Reference in New Issue
Block a user