From 850f92794a2571f44fd95f53a3f96f5ea659b3a4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 26 Feb 2021 19:28:04 +0100 Subject: initial cleanup of V2 templates diff --git a/program/templates/v2/boxes/broadcastformat.html b/program/templates/v2/boxes/broadcastformat.html deleted file mode 100644 index 8118cdb..0000000 --- a/program/templates/v2/boxes/broadcastformat.html +++ /dev/null @@ -1,11 +0,0 @@ -{% if broadcastformat_list %} -
-
Legende
- {% for bf in broadcastformat_list %} -
- {{ bf.format }} -
- {% endfor %} -
-{% endif %} diff --git a/program/templates/v2/boxes/current.html b/program/templates/v2/boxes/current.html deleted file mode 100644 index 0ac5179..0000000 --- a/program/templates/v2/boxes/current.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - Current program box - - -{% if previous_timeslot or current_timeslot or next_timeslot or after_next_timeslot %} -
-
Programm derzeit
-
- - - - - - - - - - - - - - - - - - - - - - - - -
{{ previous_timeslot.start|date:"H:i" }}  -

- {{ previous_timeslot.show.name }} -

-
{{ current_timeslot.start|date:"H:i" }} -

- {{ current_timeslot.show.name }} -

- {% if current_timeslot.note %} -

{{ current_timeslot.note.title }}

- {% else %} -

{{ current_timeslot.show.short_description }}

- {% endif %} -
{{ next_timeslot.start|date:"H:i" }}  -

{{ next_timeslot.show.name }} -

-
{{ after_next_timeslot.start|date:"H:i" }}  -

- {{ after_next_timeslot.show.name }} -

-
-
-
-{% endif %} - - diff --git a/program/templates/v2/boxes/language.html b/program/templates/v2/boxes/language.html deleted file mode 100644 index 050c342..0000000 --- a/program/templates/v2/boxes/language.html +++ /dev/null @@ -1,15 +0,0 @@ -{% if language_list %} -
-
Sprache
-
- -
-
-{% endif %} diff --git a/program/templates/v2/boxes/musicfocus.html b/program/templates/v2/boxes/musicfocus.html deleted file mode 100644 index 021185b..0000000 --- a/program/templates/v2/boxes/musicfocus.html +++ /dev/null @@ -1,15 +0,0 @@ -{% if musicfocus_list %} -
-
Musiktendenz
-
-
    - {% for mf in musicfocus_list %} -
  • - {{ mf.focus }} -
  • - {% endfor %} -
-
-
-{% endif %} diff --git a/program/templates/v2/boxes/recommendation.html b/program/templates/v2/boxes/recommendation.html deleted file mode 100644 index 3f4429e..0000000 --- a/program/templates/v2/boxes/recommendation.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Recomendations box - - -{% if recommendation_list %} -
-
Programmhinweise
-
- - {% for recommendation in recommendation_list %} - - - - - - {% endfor %} -
   - {{ recommendation.start|date:"d.m. H:i" }} - {{ recommendation.end|date:"H:i" }}
-

- {{ recommendation.show.name }} -

-

- {% if recommendation.note %} - {{ recommendation.note.title }}
- {% else %} - {{ recommendation.show.broadcastformat.format }}
- {% endif %} - [weiter] -

-
-
-
-{% endif %} - - diff --git a/program/templates/v2/boxes/showinformation.html b/program/templates/v2/boxes/showinformation.html deleted file mode 100644 index dbbe60d..0000000 --- a/program/templates/v2/boxes/showinformation.html +++ /dev/null @@ -1,16 +0,0 @@ -{% if showinformation_list %} -
-
Sendungsinfo
-
- -
-
-{% endif %} diff --git a/program/templates/v2/boxes/showtopic.html b/program/templates/v2/boxes/showtopic.html deleted file mode 100644 index 93e873a..0000000 --- a/program/templates/v2/boxes/showtopic.html +++ /dev/null @@ -1,16 +0,0 @@ -{% if showtopic_list %} -
-
Thema / Schwerpunkt
-
- -
-
-{% endif %} diff --git a/program/templates/v2/current_show.html b/program/templates/v2/current_show.html new file mode 100644 index 0000000..3ffe8c4 --- /dev/null +++ b/program/templates/v2/current_show.html @@ -0,0 +1,56 @@ + + + + + Current program box + + + + + diff --git a/program/templates/v2/day_schedule.html b/program/templates/v2/day_schedule.html index 7bab98e..ceb0bee 100644 --- a/program/templates/v2/day_schedule.html +++ b/program/templates/v2/day_schedule.html @@ -4,7 +4,7 @@ -{% load content_boxes %} +{% load filters %}
{% broadcastformatV2 %}
diff --git a/program/templates/v2/filters/broadcastformat.html b/program/templates/v2/filters/broadcastformat.html new file mode 100644 index 0000000..922c99c --- /dev/null +++ b/program/templates/v2/filters/broadcastformat.html @@ -0,0 +1,6 @@ +{% if broadcastformat_list %} + +{% endif %} diff --git a/program/templates/v2/filters/language.html b/program/templates/v2/filters/language.html new file mode 100644 index 0000000..c79122f --- /dev/null +++ b/program/templates/v2/filters/language.html @@ -0,0 +1,6 @@ +{% if language_list %} + +{% endif %} diff --git a/program/templates/v2/filters/musicfocus.html b/program/templates/v2/filters/musicfocus.html new file mode 100644 index 0000000..99bbb20 --- /dev/null +++ b/program/templates/v2/filters/musicfocus.html @@ -0,0 +1,6 @@ +{% if musicfocus_list %} + +{% endif %} diff --git a/program/templates/v2/filters/showinformation.html b/program/templates/v2/filters/showinformation.html new file mode 100644 index 0000000..bcd6cb1 --- /dev/null +++ b/program/templates/v2/filters/showinformation.html @@ -0,0 +1,6 @@ +{% if showinformation_list %} + +{% endif %} diff --git a/program/templates/v2/filters/showtopic.html b/program/templates/v2/filters/showtopic.html new file mode 100644 index 0000000..070d82a --- /dev/null +++ b/program/templates/v2/filters/showtopic.html @@ -0,0 +1,6 @@ +{% if showtopic_list %} + +{% endif %} diff --git a/program/templates/v2/recommendation.html b/program/templates/v2/recommendation.html new file mode 100644 index 0000000..36b7c02 --- /dev/null +++ b/program/templates/v2/recommendation.html @@ -0,0 +1,28 @@ + + + + + Recomendations box + + + + + diff --git a/program/templates/v2/show_list.html b/program/templates/v2/show_list.html index 1115a41..6d9d35d 100644 --- a/program/templates/v2/show_list.html +++ b/program/templates/v2/show_list.html @@ -4,7 +4,7 @@ -{% load content_boxes %} +{% load filters %}
{% broadcastformatV2 %}
diff --git a/program/templatetags/content_boxes.py b/program/templatetags/content_boxes.py index f979ca2..ece466b 100644 --- a/program/templatetags/content_boxes.py +++ b/program/templatetags/content_boxes.py @@ -5,8 +5,6 @@ from program.models import BroadcastFormat, MusicFocus, ShowInformation, ShowTop register = template.Library() -# Legacy Tags for Homepage until 2021 - @register.inclusion_tag('boxes/broadcastformat.html') def broadcastformat(): return {'broadcastformat_list': BroadcastFormat.objects.filter(enabled=True)} @@ -30,30 +28,3 @@ def showtopic(): @register.inclusion_tag('boxes/language.html') def language(): return {'language_list': Language.objects.all()} - - -# V2 Tags added for new Homepage 2021 - -@register.inclusion_tag('v2/boxes/broadcastformat.html') -def broadcastformatV2(): - return {'broadcastformat_list': BroadcastFormat.objects.filter(enabled=True)} - - -@register.inclusion_tag('v2/boxes/musicfocus.html') -def musicfocusV2(): - return {'musicfocus_list': MusicFocus.objects.all()} - - -@register.inclusion_tag('v2/boxes/showinformation.html') -def showinformationV2(): - return {'showinformation_list': ShowInformation.objects.all()} - - -@register.inclusion_tag('v2/boxes/showtopic.html') -def showtopicV2(): - return {'showtopic_list': ShowTopic.objects.all()} - - -@register.inclusion_tag('v2/boxes/language.html') -def languageV2(): - return {'language_list': Language.objects.all()} diff --git a/program/templatetags/filters.py b/program/templatetags/filters.py new file mode 100644 index 0000000..811216b --- /dev/null +++ b/program/templatetags/filters.py @@ -0,0 +1,30 @@ +from django import template + +from program.models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic, Language + +register = template.Library() + + +@register.inclusion_tag('v2/filters/broadcastformat.html') +def broadcastformatV2(): + return {'broadcastformat_list': BroadcastFormat.objects.filter(enabled=True)} + + +@register.inclusion_tag('v2/filters/musicfocus.html') +def musicfocusV2(): + return {'musicfocus_list': MusicFocus.objects.all()} + + +@register.inclusion_tag('v2/filters/showinformation.html') +def showinformationV2(): + return {'showinformation_list': ShowInformation.objects.all()} + + +@register.inclusion_tag('v2/filters/showtopic.html') +def showtopicV2(): + return {'showtopic_list': ShowTopic.objects.all()} + + +@register.inclusion_tag('v2/filters/language.html') +def languageV2(): + return {'language_list': Language.objects.all()} diff --git a/program/views.py b/program/views.py index ab7bd82..2a7609c 100644 --- a/program/views.py +++ b/program/views.py @@ -259,8 +259,26 @@ class RecommendationsListViewV2(ListView): start__range=(now, end))).order_by('start')[:20] -class RecommendationsBoxViewV2(RecommendationsListView): - template_name = 'v2/boxes/recommendation.html' +class RecommendationsBoxViewV2(RecommendationsListViewV2): + template_name = 'v2/recommendation.html' + + +class CurrentShowBoxViewV2(TemplateView): + context_object_name = 'recommendation_list' + template_name = 'v2/current_show.html' + + def get_context_data(self, **kwargs): + current_timeslot = TimeSlot.objects.get_or_create_current() + previous_timeslot = current_timeslot.get_previous_by_start() + next_timeslot = current_timeslot.get_next_by_start() + after_next_timeslot = next_timeslot.get_next_by_start() + + context = super(CurrentShowBoxViewV2, self).get_context_data(**kwargs) + context['current_timeslot'] = current_timeslot + context['previous_timeslot'] = previous_timeslot + context['next_timeslot'] = next_timeslot + context['after_next_timeslot'] = after_next_timeslot + return context class DayScheduleViewV2(TemplateView): @@ -305,24 +323,6 @@ class DayScheduleViewV2(TemplateView): return context -class CurrentShowBoxViewV2(TemplateView): - context_object_name = 'recommendation_list' - template_name = 'v2/boxes/current.html' - - def get_context_data(self, **kwargs): - current_timeslot = TimeSlot.objects.get_or_create_current() - previous_timeslot = current_timeslot.get_previous_by_start() - next_timeslot = current_timeslot.get_next_by_start() - after_next_timeslot = next_timeslot.get_next_by_start() - - context = super(CurrentShowBoxViewV2, self).get_context_data(**kwargs) - context['current_timeslot'] = current_timeslot - context['previous_timeslot'] = previous_timeslot - context['next_timeslot'] = next_timeslot - context['after_next_timeslot'] = after_next_timeslot - return context - - # Exports def json_day_schedule(request, year=None, month=None, day=None): -- cgit v0.10.2