diff options
15 files changed, 128 insertions, 63 deletions
diff --git a/helsinki/program/templates/program/box_broadcastformat.html b/helsinki/program/templates/program/box_broadcastformat.html new file mode 100644 index 0000000..20e914f --- /dev/null +++ b/helsinki/program/templates/program/box_broadcastformat.html @@ -0,0 +1,10 @@ +{% if broadcastformats %} +<dl id="broadcastformat" class="portlet"> + <dt class="portletHeader"><span>Legende<span></dt> + {% for broadcastformat in broadcastformats %} + <dd class="portletItem bcformat bf-{{ broadcastformat.slug }}"> + <a href="?broadcastformat={{ broadcastformat.slug }}">{{ broadcastformat.format }}</a> + </dd> + {% endfor %} +</dl> +{% endif %} diff --git a/helsinki/program/templates/program/box_musicfocus.html b/helsinki/program/templates/program/box_musicfocus.html new file mode 100644 index 0000000..7fe4e7e --- /dev/null +++ b/helsinki/program/templates/program/box_musicfocus.html @@ -0,0 +1,14 @@ +{% if musicfoci %} +<dl id="box_musicfocus" class="portlet filterbox"> + <dt class="portletHeader"><span>Musiktendenz<span></dt> + <dd class="portletItem"> + <ul> + {% for item in musicfoci %} + <li class="mf-{{ item.abbrev }}"> + <a href="?musicfocus={{ item.slug }}">{{ item }}</a> + </li> + {% endfor %} + </ul> + </dd> +</dl> +{% endif %} diff --git a/helsinki/program/templates/program/box_showinformation.html b/helsinki/program/templates/program/box_showinformation.html new file mode 100644 index 0000000..f96913c --- /dev/null +++ b/helsinki/program/templates/program/box_showinformation.html @@ -0,0 +1,14 @@ +{% if showinformations %} +<dl id="box_showinformation" class="portlet filterbox"> + <dt class="portletHeader"><span>Schwerpunkt<span></dt> + <dd class="portletItem"> + <ul> + {% for item in showinformations %} + <li class="si-{{ item.abbrev }}"> + <a href="?showinformation={{ item.slug }}">{{ item }}</a> + </li> + {% endfor %} + </ul> + </dd> +</dl> +{% endif %} diff --git a/helsinki/program/templates/program/box_showtopic.html b/helsinki/program/templates/program/box_showtopic.html new file mode 100644 index 0000000..c95fcab --- /dev/null +++ b/helsinki/program/templates/program/box_showtopic.html @@ -0,0 +1,14 @@ +{% if showtopics %} +<dl id="box_showtopic" class="portlet filterbox"> + <dt class="portletHeader"><span>Thema / Schwerpunkt<span></dt> + <dd class="portletItem"> + <ul> + {% for item in showtopics %} + <li class="st-{{ item.abbrev }}"> + <a href="?showtopic={{ item.slug }}">{{ item }}</a> + </li> + {% endfor %} + </ul> + </dd> +</dl> +{% endif %} diff --git a/helsinki/program/templates/program/day_schedule.html b/helsinki/program/templates/program/day_schedule.html index 880df08..a0e1ac4 100644 --- a/helsinki/program/templates/program/day_schedule.html +++ b/helsinki/program/templates/program/day_schedule.html @@ -8,7 +8,20 @@ <div id="calendar"></div> -<div id="content-main"> +{% load content_boxes %} +<div id="filter-format"> +{% broadcastformat %} +</div> +<div id="filter-topic"> + <dl id="filter-header" class="portlet"> + <dt class="portletHeader"><span>Filter<span></dt> + </dl> +{% musicfocus %} +{% showinformation %} +{% showtopic %} +</div> + +<div id="content-main" class="day-schedule"> <h2>Tagesansicht</h2> <h1 id="date">{{ day|date:"l, d.m.Y" }}</h1> diff --git a/helsinki/program/templates/program/host_detail.html b/helsinki/program/templates/program/host_detail.html index eff52d6..d28f582 100644 --- a/helsinki/program/templates/program/host_detail.html +++ b/helsinki/program/templates/program/host_detail.html @@ -5,7 +5,7 @@ </head> <body> -<div id="host-detail"> +<div id="content-main" class="host-detail"> <div id="name">{{ host.name }}</div> <div id="shows"> @@ -26,4 +26,4 @@ </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/helsinki/program/templates/program/host_list.html b/helsinki/program/templates/program/host_list.html index 5ab5c3f..9b83b29 100644 --- a/helsinki/program/templates/program/host_list.html +++ b/helsinki/program/templates/program/host_list.html @@ -5,7 +5,7 @@ </head> <body> -<div id="host-list"> +<div id="content-main" class="host-list"> {% for host in host_list %} <div class="host"> <a href="{% url host-detail host.id %}">{{ host.name }}</a> @@ -14,4 +14,4 @@ </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/helsinki/program/templates/program/recommendations.html b/helsinki/program/templates/program/recommendations.html index c34d5e5..85ec16e 100644 --- a/helsinki/program/templates/program/recommendations.html +++ b/helsinki/program/templates/program/recommendations.html @@ -5,7 +5,7 @@ </head> <body> -<div id="recommendations"> +<div id="content-main" class="recommendations"> <div id="recommendations-title">Programmhinweise</div> {% for recommendation in recommendation_list %} <div class="recommendation {{ recommendation.show.broadcastformat.slug }}"> @@ -21,4 +21,4 @@ </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/helsinki/program/templates/program/show_detail.html b/helsinki/program/templates/program/show_detail.html index e2ae528..0238ad3 100644 --- a/helsinki/program/templates/program/show_detail.html +++ b/helsinki/program/templates/program/show_detail.html @@ -6,7 +6,7 @@ <div id="calendar"></div> -<div id="show-detail"> +<div id="content-main" class="show-detail"> <h1 id="name">{{ show.name }}</h1> diff --git a/helsinki/program/templates/program/show_list.html b/helsinki/program/templates/program/show_list.html index 9539035..6fe6525 100644 --- a/helsinki/program/templates/program/show_list.html +++ b/helsinki/program/templates/program/show_list.html @@ -5,41 +5,20 @@ </head> <body> -<div id="filter"> - <div id="filter-title">Filter</div> - - <div id="showtopics"> - <div id="showtopics-title">Thema/Schwerpunkt</div> - {% for topic in showtopics %} - <div class="showtopic"> - <span class="abbrev">{{ topic.abbrev }}</span> - <span class="topic"><a href="?showtopic={{ topic.slug }}">{{ topic }}</a></span> - </div> - {% endfor %} - </div> - - <div id="showinformations"> - <div id="showinformations-title"></div> - {% for information in showinformations %} - <div class="showinformation"> - <span class="abbrev">{{ information.abbrev }}</span> - <span class="information"><a href="?showinformation={{ information.slug }}">{{ information }}</a></span> - </div> - {% endfor %} - </div> - - <div id="musicfoci"> - <div id="musicfoci-title">Musiktendenz</div> - {% for focus in musicfoci %} - <div class="musicfocus"> - <span class="abbrev">{{ focus.abbrev }}</span> - <span class="focus"><a href="?musicfocus={{ focus.slug }}">{{ focus }}</a></span> - </div> - {% endfor %} - </div> +{% load content_boxes %} +<div id="filter-format"> +{% broadcastformat %} +</div> +<div id="filter-topic"> + <dl id="filter-header" class="portlet"> + <dt class="portletHeader"><span>Filter<span></dt> + </dl> +{% musicfocus %} +{% showinformation %} +{% showtopic %} </div> -<div id="shows"> +<div id="content-main" class="show-list"> {% for show in show_list %} <div class="show"> <div class="abbrevs"> @@ -75,14 +54,5 @@ {% endfor %} </div> -<div id="broadcastformats"> - <div id="broadcastformats-title">Legende</div> - {% for broadcastformat in broadcastformats %} - <div class="{{ broadcastformat.slug }}"> - <a href="?broadcastformat={{ broadcastformat.slug }}">{{ broadcastformat.format }}</a> - </div> - {% endfor %} -</div> - </body> -</html>
\ No newline at end of file +</html> diff --git a/helsinki/program/templates/program/timeslot_detail.html b/helsinki/program/templates/program/timeslot_detail.html index 36a1e5f..04d56c2 100644 --- a/helsinki/program/templates/program/timeslot_detail.html +++ b/helsinki/program/templates/program/timeslot_detail.html @@ -5,7 +5,7 @@ </head> <body> -<div id="timeslot-detail"> +<div id="content-main" class="timeslot-detail"> <h1 id="show-name">{{ timeslot.show.name }}</h1> {% if timeslot.show.short_description != 'FIXME' %} diff --git a/helsinki/program/templates/program/week_schedule.html b/helsinki/program/templates/program/week_schedule.html index f6e8f57..76aed5a 100644 --- a/helsinki/program/templates/program/week_schedule.html +++ b/helsinki/program/templates/program/week_schedule.html @@ -6,7 +6,7 @@ <body> -<div id="week-schedule"> +<div id="content-main" class="week-schedule"> <div id="monday"> <div class="weekday">{{ monday|date:"l d.m.Y" }}</div> {% for timeslot in monday_timeslots %} diff --git a/helsinki/program/templatetags/__init__.py b/helsinki/program/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/helsinki/program/templatetags/__init__.py diff --git a/helsinki/program/templatetags/content_boxes.py b/helsinki/program/templatetags/content_boxes.py new file mode 100644 index 0000000..56c0afb --- /dev/null +++ b/helsinki/program/templatetags/content_boxes.py @@ -0,0 +1,30 @@ +# http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ + +from django import template +register = template.Library() + +from helsinki.program.models import ( + BroadcastFormat, + MusicFocus, + ShowInformation, + ShowTopic) + +@register.inclusion_tag('program/box_broadcastformat.html') +def broadcastformat(): + broadcastformats = BroadcastFormat.objects.all() + return {'broadcastformats': broadcastformats} + +@register.inclusion_tag('program/box_musicfocus.html') +def musicfocus(): + musicfoci = MusicFocus.objects.all() + return {'musicfoci': musicfoci} + +@register.inclusion_tag('program/box_showinformation.html') +def showinformation(): + showinformations = ShowInformation.objects.all() + return {'showinformations': showinformations} + +@register.inclusion_tag('program/box_showtopic.html') +def showtopic(): + showtopics = ShowTopic.objects.all() + return {'showtopics': showtopics} diff --git a/helsinki/program/views.py b/helsinki/program/views.py index 48b5d5f..a9c7b67 100644 --- a/helsinki/program/views.py +++ b/helsinki/program/views.py @@ -2,18 +2,19 @@ from django.views.generic import list_detail from django.views.generic import simple from django.shortcuts import get_object_or_404 -from helsinki.program.models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic, TimeSlot +from helsinki.program.models import ( + BroadcastFormat, + MusicFocus, + Note, + Show, + ShowInformation, + ShowTopic, + TimeSlot) from datetime import date, datetime, time, timedelta def show_list(request): - broadcastformats = BroadcastFormat.objects.all() - musicfoci = MusicFocus.objects.all() - showinformation = ShowInformation.objects.all() - showtopics = ShowTopic.objects.all() - extra_context = dict(broadcastformats=broadcastformats, musicfoci=musicfoci, showinformation=showinformation, showtopics=showtopics) - if 'broadcastformat' in request.GET: broadcastformat = get_object_or_404(BroadcastFormat, slug=request.GET['broadcastformat']) @@ -33,7 +34,7 @@ def show_list(request): else: queryset = Show.objects.all() - return list_detail.object_list(request, queryset=queryset, extra_context=extra_context, template_object_name='show') + return list_detail.object_list(request, queryset=queryset, template_object_name='show') def recommendations(request, template_name='program/recommendations.html'): now = datetime.now() @@ -51,10 +52,9 @@ def day_schedule(request, year=None, month=None, day=None): tomorrow = today+timedelta(days=1) - broadcastformats = BroadcastFormat.objects.all() recommendations = Note.objects.filter(status=1, timeslot__start__range=(today, tomorrow)) - extra_context = dict(day=today, broadcastformats=broadcastformats, recommendations=recommendations) + extra_context = dict(day=today, recommendations=recommendations) if 'broadcastformat' in request.GET: broadcastformat = get_object_or_404(BroadcastFormat, slug=request.GET['broadcastformat']) |