From 7cae9107c18b4af47057f71ac5e8d643dae57d4c Mon Sep 17 00:00:00 2001 From: Nikita <62756604+FlamesONE@users.noreply.github.com> Date: Tue, 25 Jun 2024 17:08:16 +0500 Subject: [PATCH] v0.2.2.1-alpha --- .../Admin/Http/Views/assets/js/pages/footer/list.js | 7 +++++-- .../Http/Views/assets/js/pages/navigation/list.js | 7 +++++-- .../Admin/Http/Views/assets/js/pages/roles/list.js | 10 ++++++---- .../Admin/Http/Views/pages/main/items/app.blade.php | 2 +- app/Core/App.php | 2 +- app/Core/Helpers/Translation.php | 13 ++++++++----- app/Core/Template/TemplateAssets.php | 8 ++++---- 7 files changed, 30 insertions(+), 19 deletions(-) diff --git a/app/Core/Admin/Http/Views/assets/js/pages/footer/list.js b/app/Core/Admin/Http/Views/assets/js/pages/footer/list.js index 498a6ee..ed51a35 100644 --- a/app/Core/Admin/Http/Views/assets/js/pages/footer/list.js +++ b/app/Core/Admin/Http/Views/assets/js/pages/footer/list.js @@ -1,6 +1,8 @@ $(function () { const createSortableInstances = () => { - const nestedSortables = document.querySelectorAll('.footer-nested-sortable'); + const nestedSortables = document.querySelectorAll( + '.footer-nested-sortable', + ); return Array.from(nestedSortables).map( (nestedSortable) => new Sortable(nestedSortable, { @@ -27,7 +29,8 @@ $(function () { document .querySelector('.chrome-tabs') .addEventListener('contentRender', () => { - sortablesFooter = createSortableInstances(); + if ($('#saveFooter').length) + sortablesFooter = createSortableInstances(); }); $(document).on('click', '#saveFooter', () => { diff --git a/app/Core/Admin/Http/Views/assets/js/pages/navigation/list.js b/app/Core/Admin/Http/Views/assets/js/pages/navigation/list.js index 72d28a5..54e66f6 100644 --- a/app/Core/Admin/Http/Views/assets/js/pages/navigation/list.js +++ b/app/Core/Admin/Http/Views/assets/js/pages/navigation/list.js @@ -1,6 +1,8 @@ $(function () { const createNavSortableInstances = () => { - const nestedSortables = document.querySelectorAll('.nav-nested-sortable'); + const nestedSortables = document.querySelectorAll( + '.nav-nested-sortable', + ); return Array.from(nestedSortables).map( (nestedSortable) => new Sortable(nestedSortable, { @@ -27,7 +29,8 @@ $(function () { document .querySelector('.chrome-tabs') .addEventListener('contentRender', () => { - sortablesNav = createNavSortableInstances(); + if ($('#saveNavigation').length) + sortablesNav = createNavSortableInstances(); }); $(document).on('click', '#saveNavigation', () => { diff --git a/app/Core/Admin/Http/Views/assets/js/pages/roles/list.js b/app/Core/Admin/Http/Views/assets/js/pages/roles/list.js index bcfa50f..5fc68f2 100644 --- a/app/Core/Admin/Http/Views/assets/js/pages/roles/list.js +++ b/app/Core/Admin/Http/Views/assets/js/pages/roles/list.js @@ -13,9 +13,11 @@ $(function () { let sortableRoles = createRolesSortable(); - document.querySelector('.chrome-tabs').addEventListener('contentRender', () => { - sortableRoles = createRolesSortable(); - }); + document + .querySelector('.chrome-tabs') + .addEventListener('contentRender', () => { + if ($('#roles').length) sortableRoles = createRolesSortable(); + }); $(document).on('click', '#saveRoles', (e) => { let orderedIds = sortableRoles.toArray(); @@ -60,6 +62,6 @@ $(function () { $(document).on('click', '.roles-group .delete', async function () { let roleId = $(this).data('deleterole'); if (await asyncConfirm(translate('admin.roles.confirm_delete'))) - sendRequest({},u('admin/api/roles/' + roleId), 'DELETE'); + sendRequest({}, u('admin/api/roles/' + roleId), 'DELETE'); }); }); diff --git a/app/Core/Admin/Http/Views/pages/main/items/app.blade.php b/app/Core/Admin/Http/Views/pages/main/items/app.blade.php index 71a8f53..bfa0457 100644 --- a/app/Core/Admin/Http/Views/pages/main/items/app.blade.php +++ b/app/Core/Admin/Http/Views/pages/main/items/app.blade.php @@ -131,7 +131,7 @@ class="form-control" value="{{ config('app.timezone') }}"> @t('admin.app.maintenance_message_description')