From 6a99acf7e4fd2c0548fdbe3191c0b34e6dabda3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Wed, 11 Feb 2026 10:59:10 +0300 Subject: [PATCH] fix(calendar): resolve infinite loading on manage calendar button - Removed duplicate modal opening via data-bs-toggle attribute - Changed to programmatic opening via openForCreate() only - Added calendar:edit event listener for edit functionality - Updated button selector from data-bs-target to data-action Issue: Button had both Bootstrap modal trigger and JS event listener, causing double initialization and infinite loading state. Solution: Use only programmatic modal opening through calendarManageModal API. --- .../static/js/components/calendarWidgetIntegration.js | 11 ++++++++++- .../includes/components/calendar_desktop.html | 3 +-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/static/js/components/calendarWidgetIntegration.js b/backend/static/js/components/calendarWidgetIntegration.js index 3ef1e85a..20ae7202 100644 --- a/backend/static/js/components/calendarWidgetIntegration.js +++ b/backend/static/js/components/calendarWidgetIntegration.js @@ -180,13 +180,22 @@ export function integrateCalendarManager(calendarWidgetInstance, options = {}) { }); // Привязываем кнопку создания календаря к модальному окну - const createCalendarBtn = document.querySelector('[data-bs-target="#calendarManageModal"]'); + const createCalendarBtn = document.querySelector('[data-action="create-calendar"]'); if (createCalendarBtn && manageModalInstance) { createCalendarBtn.addEventListener('click', () => { manageModalInstance.openForCreate(); }); } + // Обрабатываем событие редактирования календаря из списка + if (manageModalInstance) { + document.addEventListener('calendar:edit', (e) => { + const calendar = e.detail; + console.log('[CalendarIntegration] Edit calendar requested:', calendar); + manageModalInstance.openForEdit(calendar.id); + }); + } + // Создаём объект интеграции const integration = { /** diff --git a/backend/templates/includes/components/calendar_desktop.html b/backend/templates/includes/components/calendar_desktop.html index 5d7966d5..bab1ccbb 100644 --- a/backend/templates/includes/components/calendar_desktop.html +++ b/backend/templates/includes/components/calendar_desktop.html @@ -25,8 +25,7 @@