striptags for all user-entered strings
[mygpo.git] / mygpo / web / templates / podcast.html
blob76bf5cc52ae666fa78befea6130a286b8bfac5c9
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load humanize %}
4 {% load episodes %}
6 {% block content %}
7 <h1>{% if podcast.title %}{{ podcast.title|striptags }}{% else %}{% trans "Unnamed Podcast" %}{%endif%}</h1>
8 <a href="{{ podcast.url }}" class="URL">{{ podcast.url }}</a>
10 {% if podcast.description %}
11 <p class="description">{{ podcast.description|striptags }}</p>
12 {% endif %}
14 {% if not user.is_authenticated %}
15 <div class="subscribe">
16 <a href="/podcast/{{ podcast.id }}/subscribe">
17 {% if podcast.title %}
18 {% blocktrans with podcast.title|striptags as podcasttitle %}Subscribe to {{ podcasttitle }}{% endblocktrans %}
19 {% else %}
20 {% trans "Subscribe to this podcast" %}
21 {% endif %}
22 </a>
23 </div>
24 {% else %}
26 {% if devices|length_is:"0" %}
28 {% if can_subscribe %}
29 <div class="subscribe">
30 <a href="/podcast/{{ podcast.id }}/subscribe">
31 {% if podcast.title %}
32 {% blocktrans with podcast.title|striptags as podcasttitle %}Subscribe to {{ podcasttitle }}{% endblocktrans %}
33 {% else %}
34 {% trans "Subscribe to this podcast" %}
35 {% endif %}
36 </a>
37 </div>
38 {% endif %}
40 {% else %}
41 <h2>{% trans "Devices" %}</h2>
42 <strong>{% trans "You have subscribed this podcast on" %}</strong>
43 <ul class="devices">
44 {% for device in devices %}
45 <li class="{{device.type}}">
46 <div class="devicesLeft"><a href="/device/{{ device.id }}">{{ device|striptags }}</a></div>
47 <div class="devicesRight"><a href="{{unsubscribe}}/{{ device.id }}?return_to=/podcast/{{ podcast.id }}"><img src="/media/unsubscribe.png" /></a></div>
48 <div class="devicesClear"></div>
49 </li>
50 {% endfor %}
51 </ul>
53 {% if can_subscribe %}
54 <div class="subscribe">
55 <a href="/podcast/{{ podcast.id }}/subscribe">
56 {% if podcast.title %}
57 {% blocktrans with podcast.title|striptags as podcasttitle %}Subscribe to {{ podcasttitle }} on other devices{% endblocktrans %}
58 {% else %}
59 {% trans "Subscribe to this podcast on other devices" %}
60 {% endif %}
61 </a>
62 </div>
63 {% endif %}
65 {% endif %}
67 {% if not episodes|length_is:"0" %}
68 <h2>{% trans "Episodes" %}</h2>
69 <table class="list">
70 <tr>
71 <th></th>
72 <th>{% trans "Title" %}</th>
73 <th>{% trans "Description" %}</th>
74 <th>{% trans "Released" %}</th>
75 </tr>
77 {% for episode, action in episodes.items %}
78 <tr>
79 <td>{{ action|episode_status_icon }}</td>
80 <td><a href="/episode/{{ episode.id }}">{{ episode.title|default:"Unknown Episode"|striptags }}</a></td>
81 <td class="description">{{ episode.description|default:""|striptags|truncatewords:"15" }}</td>
82 <td>{{ episode.timestamp|default:""|naturalday }}</td>
84 </tr>
85 {% endfor %}
86 </table>
87 {% endif %}
89 {% if not history|length_is:"0" %}
90 <h2>{% trans "Subscription History" %}</h2>
91 <table class="list">
92 <tr>
93 <th>{% trans "Timestamp" %}</th>
94 <th>{% trans "Action" %}</th>
95 <th>{% trans "Devices" %}</th>
96 </tr>
97 {% for s in history %}
98 <tr>
99 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
100 <td>
101 {% ifequal s.action 1 %}
102 <img src="/media/subscribe.png" />
103 {% endifequal %}
104 {% ifequal s.action -1 %}
105 <img src="/media/unsubscribe.png" />
106 {% endifequal %}
107 </td>
108 <td>{{ s.device.name|striptags }}</td>
109 </tr>
110 {% endfor %}
111 </table>
112 {% endif %}
113 {% endif %}
114 {% if not podcast.title %}
115 <div class="info"><strong>{% trans "Why Unnamed Podcast?" %}</strong> {% trans "Because we display names after we have fetched the information form the feed -- and this may take some time. Until this is completed, the podcast will simply be called this way." %}</div>
116 {% endif %}
117 {% endblock %}