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
No related merge requests found
{% 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 @@ ...@@ -57,26 +57,8 @@
eventColor: '#127ba3', eventColor: '#127ba3',
resourceAreaWidth: '15%', resourceAreaWidth: '15%',
resourceLabelText: '{% trans "Room" %}', resourceLabelText: '{% trans "Room" %}',
resources: [ resources: {% include "AKPlan/encode_rooms.html" %},
{% for room in rooms %} events: {% with akslots as slots %}{% include "AKPlan/encode_events.html" %}{% endwith %},
{
'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 %}
],
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source', schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
}); });
......
...@@ -70,18 +70,7 @@ ...@@ -70,18 +70,7 @@
}, },
{% endfor %} {% endfor %}
], ],
events: [ events: {% with akslots as slots %}{% include "AKPlan/encode_events.html" %}{% endwith %},
{% 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 %}
],
schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source', schedulerLicenseKey: 'GPL-My-Project-Is-Open-Source',
}); });
......
...@@ -28,12 +28,16 @@ class PlanIndexView(FilterByEventSlugMixin, ListView): ...@@ -28,12 +28,16 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
context["akslots_now"] = [] context["akslots_now"] = []
context["akslots_next"] = [] context["akslots_next"] = []
rooms = set() rooms = set()
buildings = set()
# Get list of current and next slots # Get list of current and next slots
for akslot in context["akslots"]: for akslot in context["akslots"]:
# Construct a list of all rooms used by these slots on the fly # Construct a list of all rooms used by these slots on the fly
if akslot.room is not None: if akslot.room is not None:
rooms.add(akslot.room) 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 # Recent AKs: Started but not ended yet
if akslot.start <= current_timestamp <= akslot.end: if akslot.start <= current_timestamp <= akslot.end:
...@@ -45,6 +49,8 @@ class PlanIndexView(FilterByEventSlugMixin, ListView): ...@@ -45,6 +49,8 @@ class PlanIndexView(FilterByEventSlugMixin, ListView):
# Sort list of rooms by title # Sort list of rooms by title
context["rooms"] = sorted(rooms, key=lambda x: x.title) context["rooms"] = sorted(rooms, key=lambda x: x.title)
if settings.PLAN_SHOW_HIERARCHY:
context["buildings"] = sorted(buildings)
return context return context
......
...@@ -162,5 +162,7 @@ PLAN_MAX_NEXT_AKS = 10 ...@@ -162,5 +162,7 @@ PLAN_MAX_NEXT_AKS = 10
# Specify range of plan for screen/projector view # Specify range of plan for screen/projector view
PLAN_WALL_HOURS_RETROSPECT = 3 PLAN_WALL_HOURS_RETROSPECT = 3
PLAN_WALL_HOURS_FUTURE = 18 PLAN_WALL_HOURS_FUTURE = 18
# Should the plan use a hierarchy of buildings and rooms?
PLAN_SHOW_HIERARCHY = True
include(optional("settings/*.py")) include(optional("settings/*.py"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment