From 41f21d31ef0fe96f1143f5c38805b3a3698ec983 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 27 Mar 2024 09:30:11 -0400 Subject: [PATCH] Add docstring to htmx_boost template tag --- netbox/utilities/templatetags/navigation.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/netbox/utilities/templatetags/navigation.py b/netbox/utilities/templatetags/navigation.py index b34b584c1..fd492db22 100644 --- a/netbox/utilities/templatetags/navigation.py +++ b/netbox/utilities/templatetags/navigation.py @@ -47,7 +47,16 @@ def nav(context): @register.simple_tag(takes_context=True) def htmx_boost(context, target='#page-content', select='#page-content'): - if not context.get('htmx_navigation'): + """ + Renders the HTML attributes needed to effect HTMX boosting within an element if + HTMX navigation is enabled for the request. The target and select parameters are + rendered as `hx-target` and `hx-select`, respectively. For example: + +
+ + If HTMX navigation is not enabled, the tag renders no content. + """ + if not context.get('htmx_navigation', False): return '' hx_params = { 'hx-boost': 'true',