Skip to content

Commit 533e35a

Browse files
authored
feat: changelist horizontal scrollbar position (#519)
1 parent ec712b5 commit 533e35a

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ class CustomAdminClass(ModelAdmin):
321321
# Display submit button in filters
322322
list_filter_submit = False
323323

324+
# Position horizontal scrollbar in changelist at the top
325+
list_horizontal_scrollbar_top = False
326+
324327
# Custom actions
325328
actions_list = [] # Displayed above the results list
326329
actions_row = [] # Displayed in a table row in results list

src/unfold/admin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
227227
actions_submit_line = ()
228228
custom_urls = ()
229229
add_fieldsets = ()
230+
list_horizontal_scrollbar_top = False
230231
list_filter_submit = False
232+
compressed_fields = False
231233
readonly_preprocess_fields = {}
232234
checks_class = UnfoldModelAdminChecks
233235

src/unfold/static/unfold/css/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/unfold/styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,3 +641,7 @@ trix-toolbar[id^="trix-toolbar-"] {
641641
.simplebar-track .simplebar-scrollbar::before {
642642
@apply bg-gray-900/80 dark:bg-gray-400/80;
643643
}
644+
645+
.simplebar-horizontal-scrollbar-top .simplebar-track.simplebar-horizontal {
646+
@apply top-9
647+
}

src/unfold/templates/admin/change_list_results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{% endif %}
88

99
{% if results %}
10-
<div class="overflow-x-auto lg:border lg:rounded-md lg:shadow-sm lg:dark:border-gray-800" data-simplebar data-simplebar-auto-hide="false">
10+
<div class="overflow-x-auto lg:border lg:rounded-md lg:shadow-sm lg:dark:border-gray-800 {% if cl.model_admin.list_horizontal_scrollbar_top %}simplebar-horizontal-scrollbar-top{% endif %}" data-simplebar data-simplebar-auto-hide="false">
1111
<table id="result_list" class="block border-gray-200 border-spacing-none border-separate text-gray-700 w-full dark:text-gray-400 lg:table">
1212
<thead>
1313
<tr>

0 commit comments

Comments
 (0)