More program stuff.

This commit is contained in:
Víðir Valberg Guðmundsson 2016-08-07 14:36:43 +02:00
parent e8476bea51
commit 06fda68795
4 changed files with 21 additions and 6 deletions

View file

@ -115,8 +115,10 @@ footer {
} }
.event { .event {
width: 100px; max-width: 200px;
height: 100px;
display: inline-block; display: inline-block;
margin: 0 5px; margin: 5px 5px;
padding: 5px; padding: 5px;
flex: 1 1 auto;
} }

View file

@ -3,7 +3,19 @@
{% block program_content %} {% block program_content %}
{% for event in events %} {% for event in events %}
{{ event }} {% ifchanged event.event_type %}
{% if not forloop.first %}</div>{% endif %}
<h3>{{ event.event_type }}</h3>
<div style="display: flex; flex-wrap: wrap;">
{% endifchanged %}
<div class="event"
style="background-color: {{ event.event_type.color }}; border: 0; color: {% if event.event_type.light_text %}white{% else %}black{% endif %};">
<small>{{ event.start|date:"H:i" }} - {{ event.end|date:"H:i" }}</small>
<br />
{{ event }}
</div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

View file

@ -6,7 +6,7 @@
All All
</a> </a>
{% for event_type in event_types %} {% for event_type in event_types %}
<a href="{% url 'program:index' %}?type={{ event_type.slug }}" style="background-color: {{ event_type.color }}; border: 0; {% if event_type.light_text %}color: white;{% endif %}; display: inline-block; padding: 5px;"> <a href="{% url 'program:index' %}?type={{ event_type.slug }}" style="background-color: {{ event_type.color }}; border: 0; color: {% if event_type.light_text %}white{% else %}black{% endif %}; display: inline-block; padding: 5px;">
{{ event_type.name }} {{ event_type.name }}
</a> </a>
{% endfor %} {% endfor %}
@ -18,8 +18,9 @@
<div style="display: flex; flex-wrap: wrap;"> <div style="display: flex; flex-wrap: wrap;">
{% for event in events %} {% for event in events %}
<div class="event" <div class="event"
style="background-color: {{ event.event_type.color }}; border: 0; {% if event.event_type.light_text %}color: white;{% endif %};"> style="background-color: {{ event.event_type.color }}; border: 0; color: {% if event.event_type.light_text %}white{% else %}black{% endif %};">
<small>{{ event.start|date:"H:i" }} - {{ event.end|date:"H:i" }}</small> <small>{{ event.start|date:"H:i" }} - {{ event.end|date:"H:i" }}</small>
<br />
{{ event }} {{ event }}
</div> </div>
{% endfor %} {% endfor %}

View file

@ -52,7 +52,7 @@ class ProgramDayView(TemplateView):
day = int(kwargs['day']) day = int(kwargs['day'])
date = datetime.date(year=year, month=month, day=day) date = datetime.date(year=year, month=month, day=day)
day = Day.objects.filter(date=date) day = Day.objects.filter(date=date)
context['events'] = models.Event.objects.filter(days=day) context['events'] = models.Event.objects.filter(days=day).order_by('start', 'event_type')
context['event_types'] = models.EventType.objects.all() context['event_types'] = models.EventType.objects.all()
context['days'] = Day.objects.filter(date__year=year) context['days'] = Day.objects.filter(date__year=year)
return context return context