From b1ac3f7432dcfccb995023c0c934bf239fd15b67 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Fri, 13 Feb 2026 08:56:15 +0100 Subject: [PATCH 1/2] better --- app/models/communication/website/menu/item.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/models/communication/website/menu/item.rb b/app/models/communication/website/menu/item.rb index 347a429c1..5c48b52b8 100644 --- a/app/models/communication/website/menu/item.rb +++ b/app/models/communication/website/menu/item.rb @@ -143,10 +143,12 @@ def to_static_hash return nil if static_target.nil? hash = { 'title' => title, + 'slug' => title.parameterize, 'target' => static_target, 'kind' => kind, 'new_tab' => should_open_new_tab, - 'children' => children.ordered.map(&:to_static_hash).compact + 'children' => children.ordered.map(&:to_static_hash).compact, + 'descendants_targets' => descendants_targets, } if hugo.present? hash['path'] = hugo.path @@ -178,6 +180,18 @@ def siblings .where.not(id: id) end + def descendants_targets + children.collect(&:descendants_self_and_targets) + .flatten + .compact + .uniq + .sort + end + + def descendants_self_and_targets + [static_target] + children.collect(&:descendants_self_and_targets) + end + protected def hugo From 2589d60cdbae48cbf90957db0b456f0c57cc1f85 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Fri, 13 Feb 2026 08:58:25 +0100 Subject: [PATCH 2/2] fix --- app/models/communication/website/menu/item.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/communication/website/menu/item.rb b/app/models/communication/website/menu/item.rb index 5c48b52b8..b76850cad 100644 --- a/app/models/communication/website/menu/item.rb +++ b/app/models/communication/website/menu/item.rb @@ -181,15 +181,15 @@ def siblings end def descendants_targets - children.collect(&:descendants_self_and_targets) + children.collect(&:descendants_and_self_targets) .flatten .compact .uniq .sort end - def descendants_self_and_targets - [static_target] + children.collect(&:descendants_self_and_targets) + def descendants_and_self_targets + [static_target] + children.collect(&:descendants_and_self_targets) end protected