From 8a21a8c8cd4a47ec9480a2035f246c02c1b65889 Mon Sep 17 00:00:00 2001 From: Stefan Koegl Date: Sat, 30 Jan 2010 16:26:14 +0100 Subject: [PATCH] add and use template tag podcast_status_icon --- mygpo/web/templates/history.html | 7 +------ mygpo/web/templates/podcast.html | 9 +-------- mygpo/web/templatetags/podcasts.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mygpo/web/templates/history.html b/mygpo/web/templates/history.html index 9a292dd9..3649d62c 100644 --- a/mygpo/web/templates/history.html +++ b/mygpo/web/templates/history.html @@ -34,12 +34,7 @@ {{ s.timestamp|naturalday }} {% if s.podcast %} - {% ifequal s.action 1 %} - - {% endifequal %} - {% ifequal s.action -1 %} - - {% endifequal %} + {{ s|podcast_status_icon }} {% else %} {{ s|episode_status_icon }} {% endif %} diff --git a/mygpo/web/templates/podcast.html b/mygpo/web/templates/podcast.html index 5717e07c..ee22942f 100644 --- a/mygpo/web/templates/podcast.html +++ b/mygpo/web/templates/podcast.html @@ -111,14 +111,7 @@ {% for s in history %} {{ s.timestamp|naturalday }} - - {% ifequal s.action 1 %} - - {% endifequal %} - {% ifequal s.action -1 %} - - {% endifequal %} - + {{ s|podcast_status_icon }} {{ s.device|device_icon }} {{ s.device.name|striptags }} diff --git a/mygpo/web/templatetags/podcasts.py b/mygpo/web/templatetags/podcasts.py index cef4b751..fade42ec 100644 --- a/mygpo/web/templatetags/podcasts.py +++ b/mygpo/web/templatetags/podcasts.py @@ -15,3 +15,13 @@ def podcast_logo(podcast, size=32): return mark_safe(s) +@register.filter +def podcast_status_icon(action): + if action.action == 1: + s = '' + else: + s = '' + + return mark_safe(s) + + -- 2.11.4.GIT