Skip to content

Commit a91af99

Browse files
authored
Merge pull request #20537 from netbox-community/17571-remove-htmx-navigation
#17571 - Remove HTMX navigation
2 parents 18a308a + bb290dc commit a91af99

File tree

10 files changed

+6
-54
lines changed

10 files changed

+6
-54
lines changed

docs/features/user-preferences.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ Sets the default number of rows displayed on paginated tables.
3434
### Paginator placement
3535
Controls where pagination controls are rendered relative to a table.
3636

37-
### HTMX navigation (experimental)
38-
Enables partial‑page navigation for supported views. Disable this preference if unexpected behavior is observed.
39-
4037
### Striped table rows
4138
Toggles alternating row backgrounds on tables.
4239

netbox/netbox/context_processors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def preferences(request):
2828
user_preferences = request.user.config if request.user.is_authenticated else {}
2929
return {
3030
'preferences': user_preferences,
31-
'htmx_navigation': user_preferences.get('ui.htmx_navigation', False) == 'true'
3231
}
3332

3433

netbox/netbox/preferences.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ def get_csv_delimiters():
2626
PREFERENCES = {
2727

2828
# User interface
29-
'ui.htmx_navigation': UserPreference(
30-
label=_('HTMX Navigation'),
31-
choices=(
32-
('', _('Disabled')),
33-
('true', _('Enabled')),
34-
),
35-
description=_('Enable dynamic UI navigation'),
36-
default=False,
37-
warning=_('Experimental feature')
38-
),
3929
'locale.language': UserPreference(
4030
label=_('Language'),
4131
choices=(

netbox/templates/base/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h1 class="navbar-brand pb-0">
9595

9696
{# Page content #}
9797
<div class="page-wrapper">
98-
<div id="page-content" {% htmx_boost %}>
98+
<div id="page-content">
9999

100100
{# Page header #}
101101
{% block header %}

netbox/templates/inc/user_menu.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</div>
3434
</div>
3535
</a>
36-
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow" {% htmx_boost %}>
36+
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
3737
<a href="{% url 'account:profile' %}" class="dropdown-item">
3838
<i class="mdi mdi-account"></i> {% trans "Profile" %}
3939
</a>

netbox/users/forms/model_forms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def __new__(mcs, name, bases, attrs):
6161
class UserConfigForm(forms.ModelForm, metaclass=UserConfigFormMetaclass):
6262
fieldsets = (
6363
FieldSet(
64-
'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.htmx_navigation',
65-
'ui.tables.striping',
64+
'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.tables.striping',
6665
name=_('User Interface')
6766
),
6867
FieldSet('data_format', 'csv_delimiter', name=_('Miscellaneous')),

netbox/utilities/templates/navigation/menu.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% load i18n %}
33
{% load navigation %}
44

5-
<ul class="navbar-nav pt-lg-2" {% htmx_boost %}>
5+
<ul class="navbar-nav pt-lg-2">
66
<li class="nav-item d-block d-lg-none">
77
<form action="{% url 'search' %}" method="get" autocomplete="off" novalidate>
88
<div class="input-group mb-1 mt-2">

netbox/utilities/templatetags/builtins/tags.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from django import template
2-
from django.utils.safestring import mark_safe
32

43
from extras.choices import CustomFieldTypeChoices
54
from utilities.querydict import dict_to_querydict
@@ -121,9 +120,7 @@ def htmx_table(context, viewname, return_url=None, **kwargs):
121120
@register.simple_tag(takes_context=True)
122121
def formaction(context):
123122
"""
124-
Replace the 'formaction' attribute on an HTML element with the appropriate HTMX attributes
125-
if HTMX navigation is enabled (per the user's preferences).
123+
A hook for overriding the 'formaction' attribute on an HTML element, for example to replace
124+
with 'hx-push-url="true" hx-post' for HTMX navigation.
126125
"""
127-
if context.get('htmx_navigation', False):
128-
return mark_safe('hx-push-url="true" hx-post')
129126
return 'formaction'

netbox/utilities/templatetags/buttons.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def bulk_edit_button(context, model, action='bulk_edit', query_params=None):
226226
return {
227227
'label': _('Edit Selected'),
228228
'url': url,
229-
'htmx_navigation': context.get('htmx_navigation'),
230229
}
231230

232231

@@ -243,5 +242,4 @@ def bulk_delete_button(context, model, action='bulk_delete', query_params=None):
243242
return {
244243
'label': _('Delete Selected'),
245244
'url': url,
246-
'htmx_navigation': context.get('htmx_navigation'),
247245
}

netbox/utilities/templatetags/navigation.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
from django import template
2-
from django.utils.safestring import mark_safe
32

43
from netbox.navigation.menu import MENUS
54

65
__all__ = (
76
'nav',
8-
'htmx_boost',
97
)
108

119

@@ -43,30 +41,4 @@ def nav(context):
4341

4442
return {
4543
'nav_items': nav_items,
46-
'htmx_navigation': context['htmx_navigation']
4744
}
48-
49-
50-
@register.simple_tag(takes_context=True)
51-
def htmx_boost(context, target='#page-content', select='#page-content'):
52-
"""
53-
Renders the HTML attributes needed to effect HTMX boosting within an element if
54-
HTMX navigation is enabled for the request. The target and select parameters are
55-
rendered as `hx-target` and `hx-select`, respectively. For example:
56-
57-
<div id="page-content" {% htmx_boost %}>
58-
59-
If HTMX navigation is not enabled, the tag renders no content.
60-
"""
61-
if not context.get('htmx_navigation', False):
62-
return ''
63-
hx_params = {
64-
'hx-boost': 'true',
65-
'hx-target': target,
66-
'hx-select': select,
67-
'hx-swap': 'outerHTML show:window:top',
68-
}
69-
htmx_params = ' '.join([
70-
f'{k}="{v}"' for k, v in hx_params.items()
71-
])
72-
return mark_safe(htmx_params)

0 commit comments

Comments
 (0)