diff --git a/app/Views/bag/dashboard_portal.php b/app/Views/bag/dashboard_portal.php index 7da50e6..25ae5bc 100644 --- a/app/Views/bag/dashboard_portal.php +++ b/app/Views/bag/dashboard_portal.php @@ -129,7 +129,7 @@ $donutCss = $donutStops !== [] ? implode(', ', $donutStops) : '#e5e7eb 0% 100%'; } var html = '
최근 방문 메뉴
'; r.forEach(function (m) { - html += '' + esc(m.name) + + html += '' + esc(m.name) + (m.parent ? ' · ' + esc(m.parent) + '' : '') + ''; }); box.innerHTML = html; @@ -160,7 +160,28 @@ $donutCss = $donutStops !== [] ? implode(', ', $donutStops) : '#e5e7eb 0% 100%'; list.classList.remove('hidden'); } - function go(url) { if (url) window.location.href = url; } + // 워크스페이스(부모) 안이면 새 탭으로 열기, 아니면 현재 화면 이동 + function openInTab(url, name) { + try { + if (window.parent && window.parent !== window && typeof window.parent.wsOpenTab === 'function') { + window.parent.wsOpenTab(url, name || ''); + return true; + } + } catch (e) {} + return false; + } + function go(url, name) { if (!openInTab(url, name) && url) window.location.href = url; } + + // 자주 가는 화면·최근 방문 메뉴 링크 → 새 탭으로 열기 + document.addEventListener('click', function (e) { + var a = e.target.closest ? e.target.closest('a.js-tab-link') : null; + if (!a) return; + var url = a.getAttribute('href'); + if (!url || url.charAt(0) === '#') return; + if (openInTab(url, a.getAttribute('data-title') || (a.textContent || '').trim())) { + e.preventDefault(); e.stopPropagation(); + } + }, true); function highlight() { Array.prototype.forEach.call(list.children, function (li, i) { @@ -178,20 +199,20 @@ $donutCss = $donutStops !== [] ? implode(', ', $donutStops) : '#e5e7eb 0% 100%'; if (e.key === 'Enter') { e.preventDefault(); var q = input.value.trim(); - if (active >= 0 && current[active]) { go(current[active].url); return; } + if (active >= 0 && current[active]) { go(current[active].url, current[active].name); return; } // 전체 이름 정확히 일치 우선 var exact = FLAT.filter(function (m) { return norm(m.name) === norm(q); }); - if (exact.length) { go(exact[0].url); return; } - if (current.length) { go(current[0].url); return; } + if (exact.length) { go(exact[0].url, exact[0].name); return; } + if (current.length) { go(current[0].url, current[0].name); return; } var any = matches(q); - if (any.length) { go(any[0].url); return; } + if (any.length) { go(any[0].url, any[0].name); return; } alert('일치하는 메뉴가 없습니다.'); } }); list.addEventListener('mousedown', function (e) { var li = e.target.closest('li[data-url]'); - if (li) { e.preventDefault(); go(li.getAttribute('data-url')); } + if (li) { e.preventDefault(); var i = +li.getAttribute('data-i'); go(li.getAttribute('data-url'), current[i] && current[i].name); } }); document.addEventListener('click', function (e) { @@ -279,7 +300,7 @@ $donutCss = $donutStops !== [] ? implode(', ', $donutStops) : '#e5e7eb 0% 100%'; ]; foreach ($links as [$path, $label, $desc, $icon, $c]): ?> - +