Skip to content
Snippets Groups Projects
Commit 10667a08 authored by Nils Steinger's avatar Nils Steinger Committed by Benjamin Hättasch
Browse files

Extract fullcalendar import as reusable snippet

This removes support for the explicit "locale: '{{ LANGUAGE_CODE }}'" setting,
but that should not be a problem as https://fullcalendar.io/docs/v3/locale
states:
> If you are simply loading one locale, you do not need to specify the locale
> option.
parent 27267e92
No related branches found
No related tags found
No related merge requests found
{% load static %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<script src='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.js' %}'></script>
<link href='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/>
{% with 'AKPlan/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
{% if LANGUAGE_CODE != "en" %}
{# Locale 'en' is included in main.js and does not exist separately #}
<script src="{% static locale_file %}"></script>
{% endif %}
{% endwith %}
{% load static %}
{% load tz %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
<script src='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.js' %}'></script>
<link href='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/>
{% with 'AKPlan/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
{% if LANGUAGE_CODE != "en" %}
{# Locale 'en' is included in main.js and does not exist separately #}
<script src="{% static locale_file %}"></script>
{% endif %}
{% endwith %}
{% include "AKPlan/load_fullcalendar.html" %}
<script>
......@@ -22,8 +13,6 @@
// Adapt to timezone of the connected event
timeZone: '{{ ak.event.timezone }}',
initialView: 'timeGrid',
// Adapt to user selected locale
locale: '{{ LANGUAGE_CODE }}',
// No header, not buttons
headerToolbar: false,
aspectRatio: 2.5,
......
......@@ -10,17 +10,7 @@
{% endblock %}
{% block imports %}
{% get_current_language as LANGUAGE_CODE %}
<script src='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.js' %}'></script>
<link href='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/>
{% with 'AKPlan/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
{% if LANGUAGE_CODE != "en" %}
{# Locale 'en' is included in main.js and does not exist separately #}
<script src="{% static locale_file %}"></script>
{% endif %}
{% endwith %}
{% include "AKPlan/load_fullcalendar.html" %}
{% block fullcalendar %}{% endblock %}
{% endblock imports %}
......
......@@ -19,17 +19,7 @@
<link rel="stylesheet" href="{% static 'common/css/custom.css' %}">
{% get_current_language as LANGUAGE_CODE %}
<script src='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.js' %}'></script>
<link href='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/>
{% with 'AKPlan/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
{% if LANGUAGE_CODE != "en" %}
{# Locale 'en' is included in main.js and does not exist separately #}
<script src="{% static locale_file %}"></script>
{% endif %}
{% endwith %}
{% include "AKPlan/load_fullcalendar.html" %}
<script>
document.addEventListener('DOMContentLoaded', function () {
......@@ -39,8 +29,6 @@
timeZone: '{{ event.timezone }}',
headerToolbar: false,
themeSystem: 'bootstrap',
// Adapt to user selected locale
locale: '{{ LANGUAGE_CODE }}',
slotDuration: '01:00',
initialView: 'resourceTimeline',
visibleRange: {
......
......@@ -11,17 +11,7 @@
{% block extrahead %}
{{ block.super }}
{% get_current_language as LANGUAGE_CODE %}
<script src='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.js' %}'></script>
<link href='{% static 'AKPlan/vendor/fullcalendar-scheduler/main.css' %}' rel='stylesheet'/>
{% with 'AKPlan/vendor/fullcalendar-scheduler/locales/'|add:LANGUAGE_CODE|add:'.js' as locale_file %}
{% if LANGUAGE_CODE != "en" %}
{# Locale 'en' is included in main.js and does not exist separately #}
<script src="{% static locale_file %}"></script>
{% endif %}
{% endwith %}
{% include "AKPlan/load_fullcalendar.html" %}
<style>
.unscheduled-slot {
......@@ -88,8 +78,6 @@
},
//aspectRatio: 2,
themeSystem: 'bootstrap',
// Adapt to user selected locale
locale: '{{ LANGUAGE_CODE }}',
initialView: 'resourceTimelineEventVert',
views: {
resourceTimelineDayHoriz: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment