From 86307eea738d884b64b66e96e2d7fdeeca44f4ed Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:29:10 -0700 Subject: [PATCH] Prevent parent widgets from being dragged into another parent (#7449) --- core/dashboard/index.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/core/dashboard/index.php b/core/dashboard/index.php index 18b73b2dad..f5fecff785 100644 --- a/core/dashboard/index.php +++ b/core/dashboard/index.php @@ -602,7 +602,7 @@ function toggle_grid_row_end_all() { $path_array = glob(dirname(__DIR__, 2).'/*/'.$application_name.'/resources/dashboard/'.$widget_name.'.php'); if (empty($row['dashboard_parent_uuid'])) { - echo "
\n"; + echo "
\n"; if (file_exists($path_array[0])) { include $path_array[0]; } @@ -697,7 +697,13 @@ function toggle_grid_row_end_all() { } sortable = Sortable.create(widgets, { - group: 'nested', + group: { + name: 'shared', + pull: function(to, from, dragEl) { + return !dragEl.hasAttribute('data-is-parent'); + }, + put: true, + }, animation: 150, draggable: '.widget', preventOnFilter: true, @@ -717,7 +723,15 @@ function toggle_grid_row_end_all() { document.querySelectorAll('.parent_widget').forEach(function(container) { Sortable.create(container, { - group: 'nested', + group: { + name: 'shared', + pull: function(to, from, dragEl) { + return true; + }, + put: function(to, from, dragEl) { + return !dragEl.hasAttribute('data-is-parent'); + }, + }, animation: 150, draggable: '.child_widget', ghostClass: 'ghost',