Refactor Site Translations List Page and Enhance DataGrid Functionality: Updated the ListSiteTranslations page to improve session handling for view toggling between traditional table and DataGrid formats. Enhanced the getHeaderActions method for better readability and session management. Additionally, modified the render method to ensure the latest session value is utilized for rendering the appropriate view. Updated the DataGrid view to dynamically adjust the theme based on the current body class, improving user experience across different themes.

This commit is contained in:
Ümit Tunç
2026-01-10 22:59:58 +03:00
parent e80c94146d
commit ca942c5140
3 changed files with 68 additions and 37 deletions
@@ -24,7 +24,7 @@
height: calc(100vh - 250px);
min-height: 600px;
}
/*
.dx-datagrid-headers {
background-color: var(--fi-primary-50, #f0f9ff);
}
@@ -37,9 +37,31 @@
background-color: var(--fi-success-600, #16a34a);
border-color: var(--fi-success-600, #16a34a);
}
*/
</style>
<link rel="stylesheet" href="https://cdn3.devexpress.com/jslib/23.1.5/css/dx.light.css" />
<link id="devextreme-theme-css" rel="stylesheet" href="https://cdn3.devexpress.com/jslib/23.1.5/css/dx.light.css" />
<script>
(function() {
// Filament 4 varsayılan olarak 'dark'/'light' modunu body class'ı ile belirtir (ör: 'fi-dark' veya 'fi-light')
function setDevExtremeThemeCss() {
var themeCss = document.getElementById('devextreme-theme-css');
if (!themeCss) return;
var isDark = document.body.classList.contains('fi-dark');
// Eğer dark mod ise dark css'i, değilse light css'i kullan
var href = isDark
? 'https://cdn3.devexpress.com/jslib/23.1.5/css/dx.dark.css'
: 'https://cdn3.devexpress.com/jslib/23.1.5/css/dx.light.css';
if (themeCss.getAttribute('href') !== href) {
themeCss.setAttribute('href', href);
}
}
// Yüklendiğinde uygula
document.addEventListener('DOMContentLoaded', setDevExtremeThemeCss);
// Tema değişirse tekrar uygula (Filament 4 sisteminde 'body' class'ı değişir)
new MutationObserver(setDevExtremeThemeCss).observe(document.body, { attributes: true, attributeFilter: ['class'] });
})();
</script>
<script src="https://cdn3.devexpress.com/jslib/23.1.5/js/dx.all.js"></script>
<script>