mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Añadida funcionalidad de marcar el menu que esta activo
This commit is contained in:
@ -152,7 +152,8 @@ $picture = "/assets/img/default-user.png";
|
||||
<div class="sidebar-body">
|
||||
<!-- Contacts -->
|
||||
<h6 id="chat-message-notification-title">
|
||||
<?= lang("Chat.no_messages_notification") ?> </h6>
|
||||
<?= lang("Chat.no_messages_notification") ?>
|
||||
</h6>
|
||||
<ul class="list-unstyled chat-contact-list mb-0"
|
||||
id="chat-notification-list">
|
||||
|
||||
@ -413,6 +414,31 @@ $picture = "/assets/img/default-user.png";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
const browserUrl = window.location.pathname;
|
||||
|
||||
document.querySelectorAll('.menu-item a.menu-link').forEach(function (link) {
|
||||
const href = link.getAttribute('href');
|
||||
if (!href || href === 'javascript:void(0);') return;
|
||||
|
||||
const tempAnchor = document.createElement('a');
|
||||
tempAnchor.href = href;
|
||||
const linkPath = tempAnchor.pathname;
|
||||
|
||||
// Comparación exacta de ruta
|
||||
if (browserUrl === linkPath) {
|
||||
const menuItem = link.closest('.menu-item');
|
||||
menuItem.classList.add('active');
|
||||
|
||||
const parent = menuItem.closest('.menu-sub');
|
||||
if (parent) {
|
||||
const parentItem = parent.closest('.menu-item');
|
||||
if (parentItem) {
|
||||
parentItem.classList.add('active', 'open');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function adjustSidebar4ContentWrapper() {
|
||||
if ($('#sidebar').hasClass('d-none') && $(window).width() <= 768) {
|
||||
$('#contentWrapper').addClass('full-width');
|
||||
|
||||
Reference in New Issue
Block a user