Skip to content
Snippets Groups Projects
activites.html 3.16 KiB
Newer Older
{% extends "base.html" %}
{% load static %}

{% block head %}
<script src="{% static 'js/vis-timeline.min.js' %}"></script>
{% endblock %}
{% block nav_activite %}current{% endblock %}

{% block "content" %}
	{% if settings.display_planning %}
		<h2>Planning</h2>
Dorian Lesbre's avatar
Dorian Lesbre committed
		<div id="planning"></div>

		<script type="text/javascript">
			// https://visjs.org/
			// DOM element where the Timeline will be attached
Dorian Lesbre's avatar
Dorian Lesbre committed
			const container = document.getElementById('planning');
Dorian Lesbre's avatar
Dorian Lesbre committed
			const groups = new vis.DataSet([
				{id: {{ friday }}, content: "Vendredi", order: 0},
				{id: {{ saturday }}, content: "Samedi", order: 1},
				{id: {{ sunday }}, content: "Dimanche", order: 2},
			]);

			// Items in the timeline
			const items = new vis.DataSet([
				{% for act in planning %}
				{
					id: {{ act.id }},
Dorian Lesbre's avatar
Dorian Lesbre committed
					content: '<a class="hidden" href="#act-{{act.id}}"><div><strong>{{ act.title }}</strong><br>{{ act.room }}</div></a>',
					title: '<strong>{{ act.title }}</strong><br>{{ act.room }}',
Dorian Lesbre's avatar
Dorian Lesbre committed
					start: '{{ settings.date_start|date:"Y-m-d"}} {{ act.start|date:"H:i:s" }}',
					align: 'left',
Dorian Lesbre's avatar
Dorian Lesbre committed
					group: '{{ act.start|date:"d" }}',
					subgroup: '{{ act.room }}',
Dorian Lesbre's avatar
Dorian Lesbre committed
					end:'{{ settings.date_start|date:"Y-m-d"}} {{ act.end|date:"H:i:s" }}'
				},
				{% endfor %}
			]);

			// Configuration for the Timeline
Dorian Lesbre's avatar
Dorian Lesbre committed
			const start = '{{ settings.date_start|date:"Y-m-d"}} 00:00:00';
			const end = '{{ settings.date_start|date:"Y-m-d"}} 23:59:59';
Dorian Lesbre's avatar
Dorian Lesbre committed
			const options = {
				showMajorLabels: false,
				showCurrentTime: false,
Dorian Lesbre's avatar
Dorian Lesbre committed
				locale: "fr",
Dorian Lesbre's avatar
Dorian Lesbre committed
				groupOrder: "order",
Dorian Lesbre's avatar
Dorian Lesbre committed
				start: start,
				min: start,
				end: end,
				max: end,
				selectable: false,
			};

			// Create a Timeline
Dorian Lesbre's avatar
Dorian Lesbre committed
			const timeline = new vis.Timeline(container, items, options);
			timeline.setGroups(groups);
			// timeline.on('select', function (properties) {
			// 	alert('selected items: ' + properties.items);
			// });
		</script>
Dorian Lesbre's avatar
Dorian Lesbre committed

		<style>
			.vis-item {
				background-color: var(--color_bg_1);
				color: white;
			}
			.vis-item-content {
				width: 100%;
			}
			.vis-item a, .vis-item a:link, .vis-item a:visited {
				text-decoration: none;
				color: white;
				width: 100%
			}
			.vis-item a div {
				width: 100%;
			}
			.vis-item:hover {
				background-color: var(--color_bg_2);
			}
			.vis-time-axis .grid.vis-odd {
    background: #444;
  }

		</style>
	{% endif %}

	<h2>Activités</h2>
	<p>Durant tout l'événement, des jeux seront en libre-service et des tables disponibles pour jouer.
Dorian Lesbre's avatar
Dorian Lesbre committed
		Certaines activités ne pourront se faire qu'avec inscription au vue d'un nombre de places limité.
Dorian Lesbre's avatar
Dorian Lesbre committed
	{% if settings.activity_submission_form %}
	<p>Vous pouver proposer une activité en remplissant <a href="{{ settings.activity_submission_form }}">ce formulaire</a>.</p>
	{% endif %}
Dorian Lesbre's avatar
Dorian Lesbre committed

	{% for activity in activities %}
Dorian Lesbre's avatar
Dorian Lesbre committed
		<h3 id="act-{{ activity.id }}"">{{ activity.title }}</h3>
Dorian Lesbre's avatar
Dorian Lesbre committed
		{{ activity.html_display }}
Dorian Lesbre's avatar
Dorian Lesbre committed
		<dl>
Dorian Lesbre's avatar
Dorian Lesbre committed
			<dt>Durée :</dt><dd>{{ activity.pretty_duration }}</dd>
			<dt>Orga :</dt><dd>{{ activity.host_name }}</dd>
			<dt>Type :</dt><dd>{{ activity.pretty_type }}</dd>
			<dt>Places :</dt><dd>{{ activity.nb_participants }}</dd>
			<dt>Description :</dt><dd>{{ activity.description|linebreaksbr }}</dd>
Dorian Lesbre's avatar
Dorian Lesbre committed
		</dl>
	{% endfor %}
Dorian Lesbre's avatar
Dorian Lesbre committed
{% endblock %}