don't show device icon on podcast page when device is unknown
[mygpo.git] / mygpo / web / templates / podcast.html
blob8fd4dd99f95c05b8ecf2299fd98aa993273ebdbb
1 {% extends "base.html" %}
2 {% load url from future %}
3 {% load i18n %}
4 {% load humanize %}
5 {% load episodes %}
6 {% load podcasts %}
7 {% load devices %}
8 {% load charts %}
9 {% load facebook %}
10 {% load google %}
11 {% load utils %}
13 {% load menu %}
14 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
15 {% block sectionmenu %}
16 {% if podcast.title %}
17 {{ "/podcast/"|section_menu:podcast.title }}
18 {% else %}
19 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
20 {% endif %}
21 {% endblock %}
23 {% block head %}
24 {{ podcast|opengraph_podcast }}
25 {% google_plus_one_head %}
26 {% endblock %}
28 {% block title %}{{ podcast.title|default:"Unnamed Podcast"|striptags }}{% endblock %}
30 {% block header %}
32 {% if podcast.logo_url %}
33 <div id="podcastlogo">{{ podcast|podcast_logo_big }}</div>
34 {% endif %}
36 <h1>
37 {% if podcast.title %}
38 {{ podcast.title|striptags }}
39 {% else %}
40 {% trans "Unnamed Podcast" %}
41 {%endif%}
42 </h1>
44 <small class="description">
45 {% if podcast.author %}{% trans "by" %}
46 {{ podcast.author|striptags }}
47 {% endif %}
48 {% if podcast.twitter %}
49 <a href="https://twitter.com/{{ podcast.twitter|striptags }}"><i class="icon-twitter"></i></a>
50 {% endif %}&middot;
51 <a href="{{podcast.url}}" title="{% trans "Feed" %}">
52 <i class="icon-rss"></i>
53 </a>
54 {% if podcast.link %}&middot;
55 <a href="{{podcast.link}}" title="{% trans "Website" %}">
56 <i class="icon-external-link"></i>
57 </a>
58 {% endif %}
59 {% if podcast.subscriber_count %}&middot;
60 {{ podcast.subscriber_count }} {% trans "subscribers" %}
61 {% endif %}
62 </small>
64 {% if related_podcasts %}
65 <div class="related-podcasts">
66 <strong>{% trans "Also available" %}</strong>
67 {% for p in related_podcasts %}
68 {% if p.group_member_name != podcast.group_member_name %}
69 {% podcast_group_link p p.group_member_name %}
70 {% endif %}
71 {% endfor %}
72 </div>
73 {% endif %}
75 {% if podcast.description %}
76 <div class="description" {% if podcast.language %}lang="{{ podcast.language }}"{% endif %}>
77 {{ podcast.description|markdown }}
78 </div>
79 {% endif %}
81 {% endblock %}
85 {% block content %}
87 {% if episode %}
88 <div class="first-episode">
90 <h2>{{ episode.title }} <small>{{ episode.released|naturalday }}</small></h2>
91 <div class="description" {% if episode.language or podcast.language %}lang="{% firstof episode.language podcast.language %}"{% endif %}>
92 {{ episode.description|default:""|truncatewords:"100"|markdown }}
93 </div>
94 <a href="{% episode_link_target episode podcast %}">more...</a>
96 </div>
97 {% endif %}
99 {% if episodes %}
101 <h3>{% trans "Older Episodes" %}</h3>
102 <table class="list episode_list" id="episodes">
103 <tr>
104 <th></th>
105 <th>{% trans "Title" %}</th>
106 <th>{% trans "Released" %}</th>
107 <th>{% trans "Listeners" %}</th>
108 </tr>
110 {% for episode in episodes %}
111 <tr>
112 <td>{{ episode.action|episode_status_icon }}</td>
113 <td class="short">
114 <div class="title">{% episode_link episode podcast %}</div>
115 <div class="description short">{{ episode.description|default:""|truncatewords:"20"|markdown|striptags }}</div>
116 </td>
117 <td>{{ episode.released|default:""|date:"Y-m-d" }}</td>
118 <td>
119 {% if episode.listeners %}
120 {% vertical_bar episode.listeners max_listeners %}
121 {% endif %}
122 </td>
123 </tr>
124 {% endfor %}
126 {% if not podcast.episode_count or podcast.episode_count > 20 %}
127 <tr>
128 <td></td>
129 <td>
130 <a href="{% podcast_link_target podcast "podcast-all-episodes" %}?page=2">{% trans "All Episodes" %}</a>
131 </td>
132 <td></td>
133 <td></td>
134 </tr>
135 {% endif %}
137 </table>
138 {% endif %}
140 {% endblock %}
143 {% block sidebar %}
145 <div class="well">
146 <h4>{% trans "Subscriptions" %}</h4>
147 {% if not user.is_authenticated %}
148 <div class="subscribe">
149 <a href="{% podcast_link_target podcast "subscribe" %}">
150 <img src="/media/subscribe.png" style="vertical-align: middle;" alt=""/>
151 {% trans "Subscribe to this podcast" %}
152 </a>
153 </div>
154 {% endif %}
156 {% if devices or can_subscribe %}
157 <table class="list">
158 {% for device in devices %}
159 <tr>
160 <td>
161 {% if device %}
162 {{ device|device_icon }}
163 <a href="{% url "device" device.uid %}">{{ device.name|striptags }}</a>
164 {% endif %}
165 </td>
166 <td style="text-align: center;">
167 <form class="form-inline" method="post" action="{% podcast_link_target podcast "unsubscribe" device.uid %}?return_to={% podcast_link_target podcast %}">
168 {% csrf_token %}
169 <button class="btn btn-danger btn-small" type="submit">
170 <i class="icon-remove"></i>
171 </button>
172 </form>
173 </td>
174 </tr>
175 {% endfor %}
176 {% if can_subscribe %}
177 <tr>
178 <form class="form-inline" action="{% podcast_link_target podcast "subscribe" %}" method="post">
179 <td>
180 {% csrf_token %}
181 <select name="targets" id="id_targets">
182 {% for device in subscribe_targets %}
183 <option value="{{ device.uid }}">{{ device.name }}</option>
184 {% endfor %}
185 </select>
186 </td>
187 <td>
188 <button class="btn btn-success btn-small" type="submit">
189 <i class="icon-ok"></i>
190 </button>
191 </td>
192 </form>
193 </tr>
194 {% endif %}
195 </table>
196 {% endif %}
198 </div>
201 <div class="well">
202 <h4>Tags</h4>
204 {% for tag in tags %}
205 {% spaceless %}
206 {% if tag.is_own %}
207 <span class="own">{{ tag.tag }} <a class="remove" href="{% podcast_link_target podcast "remove-tag" %}?tag={{ tag.tag }}">X</a></span>
208 {% else %}
209 <span class="other">{{ tag.tag }}</span>
210 {% endif %}
211 {% if not forloop.last %}
212 <span class="seperator">,</span>
213 {% endif %}
214 {% endspaceless %}
215 {% endfor %}
217 {% if user.is_authenticated %}
218 <form class="form-inline" action="{% podcast_link_target podcast "add-tag" %}">
219 <div class="input-prepend btn-append">
220 <span class="add-on"><i class="icon-tag"></i></span><input class="input-small" type="text" name="tag" /><button class="btn btn-success" type="submit">
221 <i class="icon-plus"></i>
222 </button>
223 </div>
224 </form>
225 {% endif %}
226 </div>
228 <div class="well">
229 <h4>{% trans "Share" %}</h4>
231 {% google_plus_one_button %}
232 {{ podcast|fb_like_podcast }}
233 {% if can_flattr %}
234 <a href="{% podcast_link_target podcast "podcast-flattr" %}">
235 <img src="https://api.flattr.com/button/flattr-badge-large.png"
236 alt="Flattr {{ podcast.title|default:"Unnamed Podcast"|striptags }}" />
237 </a>
238 {% endif %}
240 </div>
243 {% if history %}
244 <div class="well">
245 <h4>{% trans "Subscription History" %}</h4>
246 <table class="list">
247 {% for s in history %}
248 <tr>
249 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
250 <td>{{ s|podcast_status_icon }}</td>
251 <td>
252 {% if s.device %}
253 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
254 {% endif %}
255 </td>
256 </tr>
257 {% endfor %}
258 </table>
259 </div>
260 {% endif %}
262 {% endblock %}
265 {% block ads %}
266 {% comment %}disable ads on podcast pages{% endcomment %}
267 {% endblock %}