Skip to content

Commit

Permalink
event_index: Use event sources
Browse files Browse the repository at this point in the history
Retrive and use internal and external events as two event sources for
FullCalendar.
  • Loading branch information
donald committed Mar 26, 2021
1 parent aadb33b commit 8f7dbff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mpicms/templates/events/event_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ <h2 class="title is-2">{{ page.title }}</h2>

</div>

{% get_json_events page as events %}
{% autoescape off %}
<script>

var event_source_internal = { events: {% get_json_events page %}, color: '#006c66' };
var event_source_external = { events: {% get_json_events page True %}, color: 'silver', textColor: 'black' };

document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');

var calendar = new FullCalendar.Calendar(calendarEl, {
plugins: [ 'dayGrid', 'timeGrid' ],
events: {{ events|safe }},
eventSources: [ event_source_internal ],
locale: '{{ LANGUAGE_CODE }}',
header: {
left: 'dayGridMonth,timeGridWeek,timeGridDay',
Expand All @@ -33,5 +36,6 @@ <h2 class="title is-2">{{ page.title }}</h2>
});

</script>
{% endautoescape %}

{% endblock %}

0 comments on commit 8f7dbff

Please sign in to comment.