mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Flag HTMX navigation as an experimental feature
This commit is contained in:
@@ -3,7 +3,7 @@ from django.conf import settings
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.postgres.forms import SimpleArrayField
|
||||
from django.core.exceptions import FieldError
|
||||
from django.utils.html import mark_safe
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from core.models import ObjectType
|
||||
@@ -37,7 +37,14 @@ class UserConfigFormMetaclass(forms.models.ModelFormMetaclass):
|
||||
preference_fields = {}
|
||||
for field_name, preference in PREFERENCES.items():
|
||||
description = f'{preference.description}<br />' if preference.description else ''
|
||||
help_text = f'{description}<code>{field_name}</code>'
|
||||
help_text = f'<code>{field_name}</code>'
|
||||
if preference.description:
|
||||
help_text = f'{preference.description}<br />{help_text}'
|
||||
if preference.experimental:
|
||||
help_text = (
|
||||
f'<span class="text-danger"><i class="mdi mdi-alert"></i> Experimental feature</span><br />'
|
||||
f'{help_text}'
|
||||
)
|
||||
field_kwargs = {
|
||||
'label': preference.label,
|
||||
'choices': preference.choices,
|
||||
|
@@ -2,9 +2,10 @@ class UserPreference:
|
||||
"""
|
||||
Represents a configurable user preference.
|
||||
"""
|
||||
def __init__(self, label, choices, default=None, description='', coerce=lambda x: x):
|
||||
def __init__(self, label, choices, default=None, description='', coerce=lambda x: x, experimental=False):
|
||||
self.label = label
|
||||
self.choices = choices
|
||||
self.default = default if default is not None else choices[0]
|
||||
self.description = description
|
||||
self.coerce = coerce
|
||||
self.experimental = experimental
|
||||
|
Reference in New Issue
Block a user