paginate "all episodes" list
[mygpo.git] / mygpo / web / templates / podcast.html
blobc3e8fa199261d9be3ee5e9daebe31162fec011fe
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 {{ device|device_icon }}
162 <a href="{% url "device" device.uid %}">{{ device.name|striptags }}</a>
163 </td>
164 <td style="text-align: center;">
165 <form class="form-inline" method="post" action="{% podcast_link_target podcast "unsubscribe" device.uid %}?return_to={% podcast_link_target podcast %}">
166 {% csrf_token %}
167 <button class="btn btn-danger btn-small" type="submit">
168 <i class="icon-remove"></i>
169 </button>
170 </form>
171 </td>
172 </tr>
173 {% endfor %}
174 {% if can_subscribe %}
175 <tr>
176 <form class="form-inline" action="{% podcast_link_target podcast "subscribe" %}" method="post">
177 <td>
178 {% csrf_token %}
179 <select name="targets" id="id_targets">
180 {% for device in subscribe_targets %}
181 <option value="{{ device.uid }}">{{ device.name }}</option>
182 {% endfor %}
183 </select>
184 </td>
185 <td>
186 <button class="btn btn-success btn-small" type="submit">
187 <i class="icon-ok"></i>
188 </button>
189 </td>
190 </form>
191 </tr>
192 {% endif %}
193 </table>
194 {% endif %}
196 </div>
199 <div class="well">
200 <h4>Tags</h4>
202 {% for tag in tags %}
203 {% spaceless %}
204 {% if tag.is_own %}
205 <span class="own">{{ tag.tag }} <a class="remove" href="{% podcast_link_target podcast "remove-tag" %}?tag={{ tag.tag }}">X</a></span>
206 {% else %}
207 <span class="other">{{ tag.tag }}</span>
208 {% endif %}
209 {% if not forloop.last %}
210 <span class="seperator">,</span>
211 {% endif %}
212 {% endspaceless %}
213 {% endfor %}
215 {% if user.is_authenticated %}
216 <form class="form-inline" action="{% podcast_link_target podcast "add-tag" %}">
217 <div class="input-prepend btn-append">
218 <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">
219 <i class="icon-plus"></i>
220 </button>
221 </div>
222 </form>
223 {% endif %}
224 </div>
226 <div class="well">
227 <h4>{% trans "Share" %}</h4>
229 {% google_plus_one_button %}
230 {{ podcast|fb_like_podcast }}
231 {% if can_flattr %}
232 <a href="{% podcast_link_target podcast "podcast-flattr" %}">
233 <img src="https://api.flattr.com/button/flattr-badge-large.png"
234 alt="Flattr {{ podcast.title|default:"Unnamed Podcast"|striptags }}" />
235 </a>
236 {% endif %}
238 </div>
241 {% if history %}
242 <div class="well">
243 <h4>{% trans "Subscription History" %}</h4>
244 <table class="list">
245 {% for s in history %}
246 <tr>
247 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
248 <td>{{ s|podcast_status_icon }}</td>
249 <td>
250 {% if s.device %}
251 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
252 {% endif %}
253 </td>
254 </tr>
255 {% endfor %}
256 </table>
257 </div>
258 {% endif %}
260 {% endblock %}
263 {% block ads %}
264 {% comment %}disable ads on podcast pages{% endcomment %}
265 {% endblock %}