fix navigation elements

This commit is contained in:
Primakov Alexandr Alexandrovich
2025-03-12 09:12:09 +03:00
parent b5301f948a
commit f91f821f86
6 changed files with 119 additions and 8 deletions

View File

@@ -53,10 +53,10 @@
<!-- Навигационная шапка -->
<header class="nav-header">
<div class="nav-container">
<a href="/questioneer" class="nav-logo">Анонимные опросы</a>
<a href="javascript:;" id="nav-home-link" class="nav-logo">Анонимные опросы</a>
<nav class="nav-menu">
<a href="/questioneer" class="nav-link active">Главная</a>
<a href="/questioneer/create" class="nav-link">Создать опрос</a>
<a href="javascript:;" id="nav-main-link" class="nav-link active">Главная</a>
<a href="javascript:;" id="nav-create-link" class="nav-link">Создать опрос</a>
</nav>
</div>
</header>
@@ -65,7 +65,7 @@
<h1>Сервис анонимных опросов</h1>
<div class="main-buttons">
<a href="/questioneer/create" class="btn">Создать новый опрос</a>
<a href="javascript:;" id="create-button" class="btn">Создать новый опрос</a>
</div>
<div class="questionnaires-list">
@@ -75,5 +75,20 @@
</div>
</div>
</div>
<script>
// Добавляем корректные пути к ссылкам после загрузки страницы
document.addEventListener('DOMContentLoaded', function() {
// Определяем базовый путь с учетом /ms в продакшен-версии
const isMsPath = window.location.pathname.includes('/ms/questioneer');
const basePath = isMsPath ? '/ms/questioneer' : '/questioneer';
// Устанавливаем правильные ссылки
document.getElementById('nav-home-link').href = basePath;
document.getElementById('nav-main-link').href = basePath;
document.getElementById('nav-create-link').href = basePath + '/create';
document.getElementById('create-button').href = basePath + '/create';
});
</script>
</body>
</html>