Skip to content

Commit 626e421

Browse files
committed
Fixes #17719: User setting table stripe
1 parent b3d318c commit 626e421

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

netbox/netbox/preferences.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ def get_page_lengths():
5454
default='bottom',
5555
description=_('Where the paginator controls will be displayed relative to a table')
5656
),
57+
'ui.table.rows.striped': UserPreference(
58+
label=_('Striped table rows'),
59+
choices=(
60+
('', _('Disabled')),
61+
('true', _('Enabled')),
62+
),
63+
description=_('Show striped effect on table rows'),
64+
default=False,
65+
),
5766

5867
# Miscellaneous
5968
'data_format': UserPreference(

netbox/netbox/tables/tables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ def configure(self, request):
163163
columns = userconfig.get(f"tables.{self.name}.columns")
164164
if ordering is None:
165165
ordering = userconfig.get(f"tables.{self.name}.ordering")
166+
if userconfig.get("ui.table.rows.striped"):
167+
self.attrs['class'] += ' table-striped'
166168

167169
# Fall back to the default columns & ordering
168170
if columns is None and hasattr(settings, 'DEFAULT_USER_PREFERENCES'):

netbox/users/forms/model_forms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class UserConfigForm(forms.ModelForm, metaclass=UserConfigFormMetaclass):
5959
fieldsets = (
6060
FieldSet(
6161
'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.htmx_navigation',
62+
'ui.table.rows.striped',
6263
name=_('User Interface')
6364
),
6465
FieldSet('data_format', name=_('Miscellaneous')),

0 commit comments

Comments
 (0)