mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #17719: User setting table stripe
This commit is contained in:
parent
b3d318cbe1
commit
626e42145a
@ -54,6 +54,15 @@ PREFERENCES = {
|
|||||||
default='bottom',
|
default='bottom',
|
||||||
description=_('Where the paginator controls will be displayed relative to a table')
|
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
|
# Miscellaneous
|
||||||
'data_format': UserPreference(
|
'data_format': UserPreference(
|
||||||
|
@ -163,6 +163,8 @@ class BaseTable(tables.Table):
|
|||||||
columns = userconfig.get(f"tables.{self.name}.columns")
|
columns = userconfig.get(f"tables.{self.name}.columns")
|
||||||
if ordering is None:
|
if ordering is None:
|
||||||
ordering = userconfig.get(f"tables.{self.name}.ordering")
|
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
|
# Fall back to the default columns & ordering
|
||||||
if columns is None and hasattr(settings, 'DEFAULT_USER_PREFERENCES'):
|
if columns is None and hasattr(settings, 'DEFAULT_USER_PREFERENCES'):
|
||||||
|
@ -59,6 +59,7 @@ class UserConfigForm(forms.ModelForm, metaclass=UserConfigFormMetaclass):
|
|||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet(
|
FieldSet(
|
||||||
'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.htmx_navigation',
|
'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.htmx_navigation',
|
||||||
|
'ui.table.rows.striped',
|
||||||
name=_('User Interface')
|
name=_('User Interface')
|
||||||
),
|
),
|
||||||
FieldSet('data_format', name=_('Miscellaneous')),
|
FieldSet('data_format', name=_('Miscellaneous')),
|
||||||
|
Loading…
Reference in New Issue
Block a user