Skip to content
Snippets Groups Projects
Commit d6a755c9 authored by Benjamin Hättasch's avatar Benjamin Hättasch
Browse files

Move event & room encoding and add more information to visualization

Move encoding to own files that can be included
Add url for linking to detail page to event encoding
Add color coding for category and track to event encoding
Introduce room hierarchy (building + room)
parent 40a7f767
No related branches found
No related tags found
1 merge request!10Port/Rewrite Plan
{% load tz %}
[
{% for slot in slots %}
{% if slot.start %}
{
'title': '{{ slot.ak.name }}',
'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
'resourceId': '{{ slot.room.title }}',
'backgroundColor': '{{ slot.ak.category.color }}',
'borderColor': '{{ slot.ak.track.color }}',
'url': '{% url 'submit:ak_detail' event_slug=event.slug pk=slot.ak.pk %}'
},
{% endif %}
{% endfor %}
]
[
{% for room in rooms %}
{
'id': '{{ room.title }}',
'title': '{{ room.title }}',
'parentId': '{{ room.building }}',
},
{% endfor %}
{% for building in buildings %}
{
'id': '{{ building }}',
'title': '{{ building }}',
},
{% endfor %}
]
......@@ -57,26 +57,8 @@
eventColor: '#127ba3',
resourceAreaWidth: '15%',
resourceLabelText: '{% trans "Room" %}',
resources: [
{% for room in rooms %}
{
'id': '{{ room.title }}',
'title': '{{ room.title }}'
},
{% endfor %}
],
events: [
{% for slot in akslots %}
{% if slot.room and slot.start %}
{
'title': '{{ slot.ak.name }}',
'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
'resourceId': '{{ slot.room.title }}',
},
{% endif %}
{% endfor %}
],
resources: {% include "AKPlan/encode_rooms.html" %},
events: {% with akslots as slots %}{% include "AKPlan/encode_events.html" %}{% endwith %},
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
});
......
......@@ -70,18 +70,7 @@
},
{% endfor %}
],
events: [
{% for slot in akslots %}
{% if slot.room and slot.start %}
{
'title': '{{ slot.ak.name }}',
'start': '{{ slot.start | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
'end': '{{ slot.end | timezone:event.timezone | date:"Y-m-d H:i:s" }}',
'resourceId': '{{ slot.room.title }}',
},
{% endif %}
{% endfor %}
],
events: {% with akslots as slots %}{% include "AKPlan/encode_events.html" %}{% endwith %},
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
});
......
......@@ -28,12 +28,16 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
context["akslots_now"] = []
context["akslots_next"] = []
rooms = set()
buildings = set()
# Get list of current and next slots
for akslot in context["akslots"]:
# Construct a list of all rooms used by these slots on the fly
if akslot.room is not None:
rooms.add(akslot.room)
# Store buildings for hierarchical view
if akslot.room.building != '':
buildings.add(akslot.room.building)
# Recent AKs: Started but not ended yet
if akslot.start <= current_timestamp <= akslot.end:
......@@ -45,6 +49,8 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
# Sort list of rooms by title
context["rooms"] = sorted(rooms, key=lambda x: x.title)
if settings.PLAN_SHOW_HIERARCHY:
context["buildings"] = sorted(buildings)
return context
......
......@@ -162,5 +162,7 @@ PLAN_MAX_NEXT_AKS = 10
# Specify range of plan for screen/projector view
PLAN_WALL_HOURS_RETROSPECT = 3
PLAN_WALL_HOURS_FUTURE = 18
# Should the plan use a hierarchy of buildings and rooms?
PLAN_SHOW_HIERARCHY = True
include(optional("settings/*.py"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment