feat(calendar.html): allow calendar to scroll
This commit is contained in:
@@ -118,42 +118,26 @@
|
|||||||
eventClick: function(info) {
|
eventClick: function(info) {
|
||||||
// prevent default navigation
|
// prevent default navigation
|
||||||
info.jsEvent.preventDefault();
|
info.jsEvent.preventDefault();
|
||||||
// show event's URL page in a modal via AJAX
|
|
||||||
const eventUrl = info.event.url;
|
const eventUrl = info.event.url;
|
||||||
const modal = document.createElement('div');
|
if (eventUrl) {
|
||||||
modal.classList.add('fixed', 'inset-0', 'flex', 'items-center', 'justify-center', 'z-50');
|
showModal(info.event.id);
|
||||||
|
}
|
||||||
const modalContent = document.createElement('div');
|
|
||||||
modalContent.classList.add('bg-white', 'rounded-lg', 'p-6', 'max-w-lg', 'w-full', 'relative');
|
|
||||||
|
|
||||||
// load event details via AJAX
|
|
||||||
fetch(eventUrl)
|
|
||||||
.then(response => response.text())
|
|
||||||
.then(html => {
|
|
||||||
modalContent.innerHTML = html;
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
modalContent.innerHTML = '<p class="text-red-500">Failed to load event details.</p>';
|
|
||||||
});
|
|
||||||
|
|
||||||
modal.appendChild(modalContent);
|
|
||||||
document.body.appendChild(modal);
|
|
||||||
|
|
||||||
const closeButton = document.createElement('button');
|
|
||||||
closeButton.classList.add('absolute', 'top-2', 'right-2', 'text-gray-500', 'hover:text-gray-700', 'focus:outline-none');
|
|
||||||
closeButton.innerHTML = '×';
|
|
||||||
closeButton.addEventListener('click', () => {
|
|
||||||
document.body.removeChild(modal);
|
|
||||||
});
|
|
||||||
modalContent.appendChild(closeButton);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
calendar.render();
|
calendar.render();
|
||||||
|
|
||||||
|
// if ?modal=event_id is in the url, open the modal for that event
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
const modalEventId = urlParams.get('modal');
|
||||||
|
if (modalEventId) {
|
||||||
|
showModal(modalEventId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "Click a course to see details and sign up." %}</h2>
|
<div class="overflow-auto">
|
||||||
<div id="calendar"></div>
|
<div id="calendar" class="min-w-xl"></div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user