Skip to content

Commit ccd92bd

Browse files
committed
fix: added translations in confirm modal and fixed ui bug
1 parent 381d09d commit ccd92bd

8 files changed

Lines changed: 40 additions & 26 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2728,7 +2728,7 @@ Quick reference for all `sbadmin_` prefixed class attributes available in `SBAdm
27282728
| `sbadmin_list_reorder_field` | str | Field name for drag-and-drop row reordering |
27292729
| `sbadmin_xlsx_options` | dict | Excel export configuration options |
27302730
| `sbadmin_table_history_enabled` | bool | Enable/disable table state history (default: `True`) |
2731-
| `sbadmin_list_sticky_footer` | bool \| None | Stick pagination footer to viewport bottom on scroll. On desktop, adds a synced horizontal scrollbar above it that mirrors the table's horizontal scroll. `None` (default) falls back to `SBAdminRoleConfiguration.default_list_sticky_footer`; explicit `True`/`False` overrides the global setting. |
2731+
| `sbadmin_list_sticky_header_and_footer` | bool \| None | Enable sticky Tabulator column header together with sticky pagination footer and synced horizontal scrollbar. `None` falls back to `SBAdminRoleConfiguration.default_list_sticky_header_and_footer`; explicit `True`/`False` overrides the global setting. |
27322732

27332733
### Detail/Change View Attributes (SBAdmin)
27342734

src/django_smartbase_admin/engine/admin_base_view.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class SBAdminBaseListView(SBAdminBaseView):
316316
sbadmin_table_history_enabled = True
317317
sbadmin_list_history_enabled = True
318318
sbadmin_list_reorder_field = None
319-
sbadmin_list_sticky_footer = None
319+
sbadmin_list_sticky_header_and_footer = None
320320
search_field_placeholder = _("Search...")
321321
filters_version = None
322322
sbadmin_actions_initialized = False
@@ -479,14 +479,16 @@ def has_add_permission(self, request, obj=None) -> bool:
479479
return False
480480
return super().has_add_permission(request)
481481

482-
def get_sbadmin_list_sticky_footer(self, request) -> bool:
483-
if self.sbadmin_list_sticky_footer is not None:
484-
return self.sbadmin_list_sticky_footer
485-
return request.request_data.configuration.default_list_sticky_footer
482+
def get_sbadmin_list_sticky_header_and_footer(self, request) -> bool:
483+
if self.sbadmin_list_sticky_header_and_footer is not None:
484+
return self.sbadmin_list_sticky_header_and_footer
485+
return request.request_data.configuration.default_list_sticky_header_and_footer
486486

487487
def get_tabulator_definition(self, request) -> dict[str, Any]:
488488
view_id = self.get_id()
489-
sticky_footer = self.get_sbadmin_list_sticky_footer(request)
489+
sticky_header_and_footer = self.get_sbadmin_list_sticky_header_and_footer(
490+
request
491+
)
490492
tabulator_definition = {
491493
"viewId": view_id,
492494
"advancedFilterId": f"{view_id}" + "-advanced-filter",
@@ -505,7 +507,7 @@ def get_tabulator_definition(self, request) -> dict[str, Any]:
505507
"tableInitialSort": self.get_list_initial_order(request),
506508
"tableInitialPageSize": self.get_list_per_page(request),
507509
"tableHistoryEnabled": self.sbadmin_table_history_enabled,
508-
"stickyFooter": sticky_footer,
510+
"stickyHeaderAndFooter": sticky_header_and_footer,
509511
# used to initialize all columns with these values
510512
"defaultColumnData": {},
511513
"locale": request.LANGUAGE_CODE,
@@ -544,8 +546,8 @@ def get_tabulator_definition(self, request) -> dict[str, Any]:
544546
"headerTabsModule",
545547
]
546548
)
547-
if sticky_footer:
548-
tabulator_definition["modules"].append("stickyFooterModule")
549+
if sticky_header_and_footer:
550+
tabulator_definition["modules"].append("stickyHeaderAndFooterModule")
549551
return tabulator_definition
550552

551553
def _get_sbadmin_list_actions(self, request) -> list[SBAdminCustomAction] | list:
@@ -769,9 +771,11 @@ def get_all_config(self, request) -> dict[str, Any]:
769771
if not list_filter:
770772
return all_config
771773
list_fields = self.get_sbadmin_list_display(request) or []
772-
list_fields = self.init_fields_cache(
774+
initialized_fields = self.init_fields_cache(
773775
list_fields, request.request_data.configuration
774776
)
777+
if initialized_fields is not None:
778+
list_fields = initialized_fields
775779
base_filter = {
776780
getattr(field, "filter_field", field): ""
777781
for field in list_fields

src/django_smartbase_admin/engine/configuration.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class SBAdminRoleConfiguration(metaclass=Singleton):
187187
default_color_scheme = ColorScheme.AUTO
188188
login_view_class = LoginView
189189
admin_title = "SBAdmin"
190-
default_list_sticky_footer = False
190+
default_list_sticky_header_and_footer = True
191191

192192
def __init__(
193193
self,
@@ -199,7 +199,7 @@ def __init__(
199199
default_color_scheme=None,
200200
login_view_class=None,
201201
admin_title=None,
202-
default_list_sticky_footer=None,
202+
default_list_sticky_header_and_footer=None,
203203
) -> None:
204204
super().__init__()
205205
self.default_view = default_view or self.default_view or []
@@ -212,8 +212,10 @@ def __init__(
212212
self.default_color_scheme = default_color_scheme or self.default_color_scheme
213213
self.login_view_class = login_view_class or self.login_view_class
214214
self.admin_title = admin_title or self.admin_title
215-
if default_list_sticky_footer is not None:
216-
self.default_list_sticky_footer = default_list_sticky_footer
215+
if default_list_sticky_header_and_footer is not None:
216+
self.default_list_sticky_header_and_footer = (
217+
default_list_sticky_header_and_footer
218+
)
217219

218220
def init_registered_views(self):
219221
registered_views = []

src/django_smartbase_admin/static/sb_admin/src/css/_tabulator.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.tabulator {
22
position: relative;
33
text-align: left;
4-
overflow: hidden;
4+
overflow: visible;
55
transform: translateZ(0);
66
@apply text-14;
77
}
@@ -28,6 +28,12 @@
2828
@apply border-b border-dark-200 bg-dark-50 text-dark-600;
2929
}
3030

31+
.tabulator.tabulator--sticky-header-and-footer .tabulator-header {
32+
position: sticky;
33+
top: 0;
34+
z-index: 10;
35+
}
36+
3137
.tabulator .tabulator-header.tabulator-header-hidden {
3238
display: none;
3339
}

src/django_smartbase_admin/static/sb_admin/src/js/table.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {MovableColumnsModule} from "./table_modules/movable_columns_module"
1010
import {DataEditModule} from "./table_modules/data_edit_module"
1111
import {FullTextSearchModule} from "./table_modules/full_text_search_module"
1212
import { HeaderTabsModule } from "./table_modules/header_tabs_module"
13-
import { StickyFooterModule } from "./table_modules/sticky_footer_module"
13+
import { StickyHeaderAndFooterModule } from "./table_modules/sticky_header_and_footer_module"
1414
import { SBAjaxParamsTabulatorModifier } from "./sb_ajax_params_tabulator_modifier"
1515

1616

@@ -381,5 +381,5 @@ window.SBAdminTableModulesClass = {
381381
'dataEditModule': DataEditModule,
382382
'fullTextSearchModule': FullTextSearchModule,
383383
'headerTabsModule': HeaderTabsModule,
384-
'stickyFooterModule': StickyFooterModule,
384+
'stickyHeaderAndFooterModule': StickyHeaderAndFooterModule,
385385
}

src/django_smartbase_admin/static/sb_admin/src/js/table_modules/sticky_footer_module.js renamed to src/django_smartbase_admin/static/sb_admin/src/js/table_modules/sticky_header_and_footer_module.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
import { SBAdminTableModule } from "./base_module"
22

33

4-
export class StickyFooterModule extends SBAdminTableModule {
4+
export class StickyHeaderAndFooterModule extends SBAdminTableModule {
55

66
afterInit() {
7+
const tableEl = this.table.tabulator.element
8+
tableEl.classList.add("tabulator--sticky-header-and-footer")
9+
710
const scrollbar = document.querySelector(
811
`[data-sticky-scrollbar="${this.table.viewId}"]`
912
)
1013
if (!scrollbar) {
11-
console.warn(`[StickyFooterModule] sticky scrollbar element missing for viewId: ${this.table.viewId}`)
14+
console.warn(`[StickyHeaderAndFooterModule] sticky scrollbar element missing for viewId: ${this.table.viewId}`)
1215
return
1316
}
1417
const spacer = scrollbar.firstElementChild
15-
const tableEl = this.table.tabulator.element
1618
const tableholder = tableEl.querySelector(".tabulator-tableholder")
1719
if (!tableholder || !spacer) {
18-
console.warn(`[StickyFooterModule] tableholder or spacer missing for viewId: ${this.table.viewId}`)
20+
console.warn(`[StickyHeaderAndFooterModule] tableholder or spacer missing for viewId: ${this.table.viewId}`)
1921
return
2022
}
2123

src/django_smartbase_admin/templates/sb_admin/actions/list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ <h1 class="text-24 md:text-30 text-dark-900 font-bold font-heading line-clamp-1
105105
<div id="{{ view_id }}-table" class="list-view-table"></div>
106106
{% endblock %}
107107
{% block tabulator_custom_footer %}
108-
<div class="tabulator-custom-footer{% if content_context.tabulator_definition.stickyFooter %} tabulator-custom-footer--sticky{% endif %}">
109-
{% if content_context.tabulator_definition.stickyFooter %}
110-
<div class="tabulator-sticky-scrollbar max-lg:hidden" data-sticky-scrollbar="{{ view_id }}">
108+
<div class="tabulator-custom-footer{% if content_context.tabulator_definition.stickyHeaderAndFooter %} tabulator-custom-footer--sticky{% endif %}">
109+
{% if content_context.tabulator_definition.stickyHeaderAndFooter %}
110+
<div class="tabulator-sticky-scrollbar" data-sticky-scrollbar="{{ view_id }}">
111111
<div class="tabulator-sticky-scrollbar__spacer"></div>
112112
</div>
113113
{% endif %}

src/django_smartbase_admin/templates/sb_admin/actions/partials/tabulator_header_v1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
{% endwith %}
3939
{% endblock %}
4040
{% include 'sb_admin/actions/partials/selected_rows_actions.html' %}
41-
</div>
41+
</div>

0 commit comments

Comments
 (0)