diff --git a/netbox/netbox/preferences.py b/netbox/netbox/preferences.py index 4fdb7e31fe7..ca575bb57b7 100644 --- a/netbox/netbox/preferences.py +++ b/netbox/netbox/preferences.py @@ -54,6 +54,15 @@ def get_page_lengths(): default='bottom', description=_('Where the paginator controls will be displayed relative to a table') ), + 'ui.table.rows.striped': UserPreference( + label=_('Striped table rows'), + choices=( + ('', _('Disabled')), + ('true', _('Enabled')), + ), + description=_('Show striped effect on table rows'), + default=False, + ), # Miscellaneous 'data_format': UserPreference( diff --git a/netbox/netbox/tables/tables.py b/netbox/netbox/tables/tables.py index 6f6b30af20a..efca8b48ecb 100644 --- a/netbox/netbox/tables/tables.py +++ b/netbox/netbox/tables/tables.py @@ -163,6 +163,8 @@ def configure(self, request): columns = userconfig.get(f"tables.{self.name}.columns") if ordering is None: ordering = userconfig.get(f"tables.{self.name}.ordering") + if userconfig.get("ui.table.rows.striped"): + self.attrs['class'] += ' table-striped' # Fall back to the default columns & ordering if columns is None and hasattr(settings, 'DEFAULT_USER_PREFERENCES'): diff --git a/netbox/users/forms/model_forms.py b/netbox/users/forms/model_forms.py index 42c3b15f0a2..9f73330a973 100644 --- a/netbox/users/forms/model_forms.py +++ b/netbox/users/forms/model_forms.py @@ -59,6 +59,7 @@ class UserConfigForm(forms.ModelForm, metaclass=UserConfigFormMetaclass): fieldsets = ( FieldSet( 'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.htmx_navigation', + 'ui.table.rows.striped', name=_('User Interface') ), FieldSet('data_format', name=_('Miscellaneous')),