mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #5429: Enable toggling the placement of table paginators
This commit is contained in:
@@ -26,6 +26,16 @@ PREFERENCES = {
|
||||
description='The number of objects to display per page',
|
||||
coerce=lambda x: int(x)
|
||||
),
|
||||
'pagination.placement': UserPreference(
|
||||
label='Paginator placement',
|
||||
choices=(
|
||||
('bottom', 'Bottom'),
|
||||
('top', 'Top'),
|
||||
('both', 'Both'),
|
||||
),
|
||||
description='Where the paginator controls will be displayed relative to a table',
|
||||
default='bottom'
|
||||
),
|
||||
|
||||
# Miscellaneous
|
||||
'data_format': UserPreference(
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
{# Render an HTMX-enabled table with paginator #}
|
||||
{% load helpers %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% render_table table 'inc/table_htmx.html' %}
|
||||
{% include 'inc/paginator_htmx.html' with paginator=table.paginator page=table.page %}
|
||||
{% with preferences|get_key:"pagination.placement" as paginator_placement %}
|
||||
{% if paginator_placement == 'top' or paginator_placement == 'both' %}
|
||||
{% include 'inc/paginator_htmx.html' with paginator=table.paginator page=table.page %}
|
||||
{% endif %}
|
||||
{% render_table table 'inc/table_htmx.html' %}
|
||||
{% if paginator_placement != 'top' %}
|
||||
{% include 'inc/paginator_htmx.html' with paginator=table.paginator page=table.page %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
@@ -47,6 +47,7 @@ class UserConfigForm(BootstrapMixin, forms.ModelForm, metaclass=UserConfigFormMe
|
||||
fieldsets = (
|
||||
('User Interface', (
|
||||
'pagination.per_page',
|
||||
'pagination.placement',
|
||||
'ui.colormode',
|
||||
)),
|
||||
('Miscellaneous', (
|
||||
|
||||
Reference in New Issue
Block a user