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 {
width: 100px;
max-width: 200px;
height: 100px;
display: inline-block;
margin: 0 5px;
margin: 5px 5px;
padding: 5px;
flex: 1 1 auto;
}

View file

@ -3,7 +3,19 @@
{% block program_content %}
{% 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 %}
{% endblock %}

View file

@ -6,7 +6,7 @@
All
</a>
{% 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 }}
</a>
{% endfor %}
@ -18,8 +18,9 @@
<div style="display: flex; flex-wrap: wrap;">
{% for event in events %}
<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>
<br />
{{ event }}
</div>
{% endfor %}

View file

@ -52,7 +52,7 @@ class ProgramDayView(TemplateView):
day = int(kwargs['day'])
date = datetime.date(year=year, month=month, day=day)
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['days'] = Day.objects.filter(date__year=year)
return context