Revert "운영 메뉴에서 지정판매소 활성 상태가 중복되지 않도록 보정"
This reverts commit 48e5578611.
This commit is contained in:
@@ -16,28 +16,11 @@ $userNav = session_user_nav_display();
|
|||||||
$currentPath = current_nav_request_path();
|
$currentPath = current_nav_request_path();
|
||||||
$adminNavTree = get_admin_nav_tree();
|
$adminNavTree = get_admin_nav_tree();
|
||||||
|
|
||||||
$resolveAdminNavNodeMatchLen = static function (object $node) use ($currentPath): int {
|
/** DB 링크(mm_link)만 사용. 짧게 적은 항목(menus 등)은 실제 URI(admin/menus)와 맞춰 후보 비교 */
|
||||||
$maxLen = -1;
|
$adminNavItemIsCurrent = static function (?string $mmLink) use ($currentPath): bool {
|
||||||
foreach (menu_link_candidate_paths($node->mm_link ?? null, $currentPath) as $cand) {
|
return menu_link_matches_request($mmLink, $currentPath, []);
|
||||||
if (menu_single_path_matches_request($cand, $currentPath, [])) {
|
|
||||||
$maxLen = max($maxLen, strlen($cand));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $maxLen;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$activeAdminTopNav = null;
|
|
||||||
$activeAdminTopLen = -1;
|
|
||||||
$activeAdminTopNum = PHP_INT_MAX;
|
|
||||||
foreach ($adminNavTree as $topNode) {
|
|
||||||
$nodeLen = $resolveAdminNavNodeMatchLen($topNode);
|
|
||||||
if ($nodeLen > $activeAdminTopLen || ($nodeLen === $activeAdminTopLen && (int) ($topNode->mm_num ?? 0) < $activeAdminTopNum)) {
|
|
||||||
$activeAdminTopNav = $topNode;
|
|
||||||
$activeAdminTopLen = $nodeLen;
|
|
||||||
$activeAdminTopNum = (int) ($topNode->mm_num ?? 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 메뉴가 DB에서 안 쓰일 때만(폴백 상단바) 세그먼트 기반 활성 */
|
/** 메뉴가 DB에서 안 쓰일 때만(폴백 상단바) 세그먼트 기반 활성 */
|
||||||
$isActive = static function (string $path) use ($uri, $seg3) {
|
$isActive = static function (string $path) use ($uri, $seg3) {
|
||||||
if ($path === 'admin' || $path === '') return $uri === '';
|
if ($path === 'admin' || $path === '') return $uri === '';
|
||||||
@@ -110,7 +93,15 @@ body { overflow: hidden; }
|
|||||||
<?php
|
<?php
|
||||||
$hasChildren = ! empty($navItem->children);
|
$hasChildren = ! empty($navItem->children);
|
||||||
$parentLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
|
$parentLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
|
||||||
$parentIsCurrent = ($activeAdminTopNav !== null && $navItem === $activeAdminTopNav);
|
$parentIsCurrent = $adminNavItemIsCurrent($navItem->mm_link ?? null);
|
||||||
|
if (! $parentIsCurrent && $hasChildren) {
|
||||||
|
foreach ($navItem->children as $ch) {
|
||||||
|
if ($adminNavItemIsCurrent($ch->mm_link ?? null)) {
|
||||||
|
$parentIsCurrent = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="relative group">
|
<div class="relative group">
|
||||||
<a class="<?= $parentIsCurrent ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
|
<a class="<?= $parentIsCurrent ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
|
||||||
@@ -121,13 +112,10 @@ body { overflow: hidden; }
|
|||||||
<?php /* 사이트 메뉴와 동일: 호버 끊김 방지 pt-1, 키보드 포커스, z-index */ ?>
|
<?php /* 사이트 메뉴와 동일: 호버 끊김 방지 pt-1, 키보드 포커스, z-index */ ?>
|
||||||
<div class="absolute left-0 top-full z-50 hidden pt-1 min-w-[12rem] group-hover:block group-focus-within:block">
|
<div class="absolute left-0 top-full z-50 hidden pt-1 min-w-[12rem] group-hover:block group-focus-within:block">
|
||||||
<div class="bg-white border border-gray-200 rounded shadow-lg py-1">
|
<div class="bg-white border border-gray-200 rounded shadow-lg py-1">
|
||||||
<?php
|
|
||||||
$activeChild = site_nav_active_child_for_parent($navItem, $currentPath, []);
|
|
||||||
?>
|
|
||||||
<?php foreach ($navItem->children as $child): ?>
|
<?php foreach ($navItem->children as $child): ?>
|
||||||
<?php
|
<?php
|
||||||
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
|
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
|
||||||
$childIsCurrent = $activeChild !== null && $child === $activeChild;
|
$childIsCurrent = $adminNavItemIsCurrent($child->mm_link ?? null);
|
||||||
?>
|
?>
|
||||||
<?php if ($childLink !== ''): ?>
|
<?php if ($childLink !== ''): ?>
|
||||||
<a href="<?= base_url($childLink) ?>"
|
<a href="<?= base_url($childLink) ?>"
|
||||||
|
|||||||
@@ -13,28 +13,6 @@ if ($effectiveLgIdx) {
|
|||||||
$effectiveLgName = $lgRow ? $lgRow->lg_name : null;
|
$effectiveLgName = $lgRow ? $lgRow->lg_name : null;
|
||||||
}
|
}
|
||||||
$userNav = session_user_nav_display();
|
$userNav = session_user_nav_display();
|
||||||
|
|
||||||
$resolveNavNodeMatchLen = static function (object $node) use ($currentPath, $dashboardPathAliases): int {
|
|
||||||
$maxLen = -1;
|
|
||||||
foreach (menu_link_candidate_paths($node->mm_link ?? null, $currentPath) as $cand) {
|
|
||||||
if (menu_single_path_matches_request($cand, $currentPath, $dashboardPathAliases)) {
|
|
||||||
$maxLen = max($maxLen, strlen($cand));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $maxLen;
|
|
||||||
};
|
|
||||||
|
|
||||||
$activeTopNav = null;
|
|
||||||
$activeTopLen = -1;
|
|
||||||
$activeTopNum = PHP_INT_MAX;
|
|
||||||
foreach ($siteNavTree as $topNode) {
|
|
||||||
$nodeLen = $resolveNavNodeMatchLen($topNode);
|
|
||||||
if ($nodeLen > $activeTopLen || ($nodeLen === $activeTopLen && (int) ($topNode->mm_num ?? 0) < $activeTopNum)) {
|
|
||||||
$activeTop = $topNode;
|
|
||||||
$activeTopLen = $nodeLen;
|
|
||||||
$activeTopNum = (int) ($topNode->mm_num ?? 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ko">
|
<html lang="ko">
|
||||||
@@ -93,7 +71,15 @@ body { overflow: hidden; }
|
|||||||
<?php foreach ($siteNavTree as $navItem): ?>
|
<?php foreach ($siteNavTree as $navItem): ?>
|
||||||
<?php
|
<?php
|
||||||
$navLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
|
$navLink = menu_link_preferred_href_path($navItem->mm_link ?? null, $currentPath);
|
||||||
$isActive = ($activeTop !== null && $navItem === $activeTop);
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="relative group">
|
<div class="relative group">
|
||||||
<a class="<?= $isActive ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
|
<a class="<?= $isActive ? 'text-blue-700 font-bold border-b-2 border-blue-700 pb-3 -mb-3' : 'hover:text-blue-600' ?>"
|
||||||
@@ -104,13 +90,10 @@ body { overflow: hidden; }
|
|||||||
<?php /* -mt-1 + pt-2: 부모 링크와 패널이 살짝 겹쳐 호버가 끊기지 않게 함. z-index: 드롭다운 클릭 우선 */ ?>
|
<?php /* -mt-1 + pt-2: 부모 링크와 패널이 살짝 겹쳐 호버가 끊기지 않게 함. z-index: 드롭다운 클릭 우선 */ ?>
|
||||||
<div class="absolute left-0 top-full z-[200] -mt-1 pt-2 min-w-[12rem] hidden group-hover:block group-focus-within:block">
|
<div class="absolute left-0 top-full z-[200] -mt-1 pt-2 min-w-[12rem] hidden group-hover:block group-focus-within:block">
|
||||||
<div class="bg-white border border-gray-200 rounded shadow-lg py-1">
|
<div class="bg-white border border-gray-200 rounded shadow-lg py-1">
|
||||||
<?php
|
|
||||||
$activeChild = site_nav_active_child_for_parent($navItem, $currentPath, $dashboardPathAliases);
|
|
||||||
?>
|
|
||||||
<?php foreach ($navItem->children as $child): ?>
|
<?php foreach ($navItem->children as $child): ?>
|
||||||
<?php
|
<?php
|
||||||
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
|
$childLink = menu_link_preferred_href_path($child->mm_link ?? null, $currentPath);
|
||||||
$childCurrent = $activeChild !== null && $child === $activeChild;
|
$childCurrent = menu_link_matches_request($child->mm_link ?? null, $currentPath, $dashboardPathAliases);
|
||||||
?>
|
?>
|
||||||
<?php if ($childLink !== ''): ?>
|
<?php if ($childLink !== ''): ?>
|
||||||
<a href="<?= base_url($childLink) ?>"
|
<a href="<?= base_url($childLink) ?>"
|
||||||
|
|||||||
Reference in New Issue
Block a user