지정판매소 소메뉴 활성 상태를 단일 선택으로 보정

지정판매소 관련 형제 소메뉴가 동시에 활성화되던 문제를 해결하고, bag/admin 레이아웃 모두에서 현재 경로 기준으로 가장 구체적인 하위 메뉴 하나만 활성화되도록 통일했다.

Made-with: Cursor
This commit is contained in:
taekyoungc
2026-04-14 11:59:33 +09:00
parent 5d733ac0d8
commit 40db578e85
4 changed files with 99 additions and 17 deletions

View File

@@ -93,14 +93,10 @@ body { overflow: hidden; }
<?php
$hasChildren = ! empty($navItem->children);
$parentLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
$activeChild = $hasChildren ? menu_active_child_for_parent($navItem, $currentPath, []) : null;
$parentIsCurrent = $adminNavItemIsCurrent($navItem->mm_link ?? null);
if (! $parentIsCurrent && $hasChildren) {
foreach ($navItem->children as $ch) {
if ($adminNavItemIsCurrent($ch->mm_link ?? null)) {
$parentIsCurrent = true;
break;
}
}
if (! $parentIsCurrent && $activeChild !== null) {
$parentIsCurrent = true;
}
?>
<div class="relative group">
@@ -115,7 +111,8 @@ body { overflow: hidden; }
<?php foreach ($navItem->children as $child): ?>
<?php
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
$childIsCurrent = $adminNavItemIsCurrent($child->mm_link ?? null);
$childIsCurrent = $activeChild !== null
&& (int) ($child->mm_idx ?? 0) === (int) ($activeChild->mm_idx ?? -1);
?>
<?php if ($childLink !== ''): ?>
<a href="<?= base_url($childLink) ?>"

View File

@@ -71,14 +71,12 @@ body { overflow: hidden; }
<?php foreach ($siteNavTree as $navItem): ?>
<?php
$navLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
$activeChild = ! empty($navItem->children)
? menu_active_child_for_parent($navItem, $currentPath, $dashboardPathAliases)
: null;
$isActive = site_nav_link_matches_current($navItem->mm_link ?? null, $currentPath, $dashboardPathAliases);
if (! $isActive && ! empty($navItem->children)) {
foreach ($navItem->children as $ch) {
if (site_nav_link_matches_current($ch->mm_link ?? null, $currentPath, $dashboardPathAliases)) {
$isActive = true;
break;
}
}
if (! $isActive && $activeChild !== null) {
$isActive = true;
}
?>
<div class="relative group">
@@ -93,7 +91,8 @@ body { overflow: hidden; }
<?php foreach ($navItem->children as $child): ?>
<?php
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
$childCurrent = menu_link_matches_request($child->mm_link ?? null, $currentPath, $dashboardPathAliases);
$childCurrent = $activeChild !== null
&& (int) ($child->mm_idx ?? 0) === (int) ($activeChild->mm_idx ?? -1);
?>
<?php if ($childLink !== ''): ?>
<a href="<?= base_url($childLink) ?>"