mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-13 08:44:51 -06:00
* Fixes #17719: User setting table stripe * Tweak user preference name --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
parent
c48e4f590e
commit
3ecf29d797
@ -54,6 +54,14 @@ PREFERENCES = {
|
||||
default='bottom',
|
||||
description=_('Where the paginator controls will be displayed relative to a table')
|
||||
),
|
||||
'ui.tables.striping': UserPreference(
|
||||
label=_('Striped table rows'),
|
||||
choices=(
|
||||
('', _('Disabled')),
|
||||
('true', _('Enabled')),
|
||||
),
|
||||
description=_('Render table rows with alternating colors to increase readability'),
|
||||
),
|
||||
|
||||
# Miscellaneous
|
||||
'data_format': UserPreference(
|
||||
|
@ -166,6 +166,8 @@ class BaseTable(tables.Table):
|
||||
columns = userconfig.get(f"tables.{self.name}.columns")
|
||||
if ordering is None:
|
||||
ordering = userconfig.get(f"tables.{self.name}.ordering")
|
||||
if userconfig.get("ui.tables.striping"):
|
||||
self.attrs['class'] += ' table-striped'
|
||||
|
||||
# Fall back to the default columns & ordering
|
||||
if columns is None and hasattr(settings, 'DEFAULT_USER_PREFERENCES'):
|
||||
|
@ -59,6 +59,7 @@ class UserConfigForm(forms.ModelForm, metaclass=UserConfigFormMetaclass):
|
||||
fieldsets = (
|
||||
FieldSet(
|
||||
'locale.language', 'pagination.per_page', 'pagination.placement', 'ui.htmx_navigation',
|
||||
'ui.tables.striping',
|
||||
name=_('User Interface')
|
||||
),
|
||||
FieldSet('data_format', name=_('Miscellaneous')),
|
||||
|
Loading…
Reference in New Issue
Block a user