let podcasts, episodes link to their publisher pages
[mygpo.git] / mygpo / web / templates / episode.html
blobf8cc0e2a4fa6c9f35d79c4c35497a86361f5c0a1
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load humanize %}
4 {% load episodes %}
5 {% load devices %}
6 {% load podcasts %}
7 {% load mygpoutil %}
8 {% load time %}
9 {% load youtube %}
10 {% load flickr %}
11 {% load facebook %}
12 {% load google %}
13 {% load charts %}
14 {% load utils %}
16 {% load menu %}
17 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
18 {% block sectionmenu %}
19 {% if podcast.title %}
20 {{ "/podcast/"|section_menu:podcast.title }}
21 {% else %}
22 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
23 {% endif %}
24 {% endblock %}
26 {% block head %}
27 {% if episode.url|is_youtube_video %}
28 <script type="text/javascript" src="/media/js/swfobject.js"></script>
29 <script type="text/javascript" src="/media/js/json2.js"></script>
30 <script type="text/javascript" src="/media/js/youtube-handler.js"></script>
31 {% endif %}
32 {% opengraph_episode episode podcast %}
33 {% google_plus_one_head %}
35 {% endblock head %}
37 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
39 {% block header %}
41 {% if podcast.logo_url %}
42 <div id="podcastlogo"><a href="{% podcast_link_target podcast %}">{{ podcast|podcast_logo_big }}</a></div>
43 {% endif %}
44 <h1>
45 {{ episode.title|default:"Unnamed Episode"|striptags }}
46 {% if episode.released %}
47 <small>{{ episode.released|naturalday }}</small>
48 {% endif %}
49 </h1>
50 <small class="description">
51 {% trans "from" %} {% podcast_group_link podcast %}&middot;
52 {% if not episode.outdated or "hide-outdated-urls" not in podcast.restrictions %}
53 <a href="{{episode.url}}" title="{% trans "Download" %}">
54 <i class="icon-download"></i>
55 </a>
56 {% endif %}
57 {% if episode.link and episode.link != episode.url %}&middot;
58 <a href="{{episode.link}}" title="{% trans "Website" %}">
59 <i class="icon-external-link"></i>
60 </a>
61 {% endif %}
62 {% if episode.listeners %}&middot;
63 {{ episode.listeners }} {% trans "listeners" %}
64 {% endif %}
65 </small>
67 {% endblock %}
71 {% block content %}
73 {% if episode.content or episode.description %}
74 <div class="description" {% if episode.language or podcast.language %}lang="{% firstof episode.language podcast.language %}"{% endif %}>
75 {% if episode.content %}
76 {{ episode.content|markdown }}
77 {% else %}
78 {{ episode.description|markdown }}
79 {% endif %}
80 </div>
81 {% endif %}
83 {% if episode.url|is_youtube_video %}
84 <div id="ytapiplayer">
85 You need Flash player 8+ and JavaScript enabled to view this video.
86 </div>
87 {% endif %}
90 {% if episode.url|is_flickr_photo %}
91 {{ episode|embed_flickr_photo }}
92 {% endif %}
94 {% if episode|is_image %}
95 <img src="{{ episode.url }}" />
96 {% endif %}
98 {% if user.is_authenticated %}
100 {% if is_favorite %}
101 <a class="btn" href="{% episode_link_target episode podcast "episode-fav" %}">
102 <i class="icon-star"></i> {% trans "Remove Favorite" %}
103 </a>
104 {% else %}
105 <a class="btn" href="{% episode_link_target episode podcast "episode-fav" %}">
106 <i class="icon-star-empty"></i> {% trans "Favorite" %}
107 </a>
108 {% endif %}
110 {% if played_parts %}
111 <h3>Already played</h3>
112 {{ played_parts|episode_heatmap_visualization }}
113 {% endif %}
115 {% endif %}
117 <div class="pagination">
118 <ul>
119 {% if prev %}
120 <li>
121 {% episode_link prev podcast %}
122 </li>
123 {% endif %}
124 <li>
125 <a href="{% podcast_link_target podcast %}#episodes">{% trans "..." %}</a>
126 </li>
127 {% if next %}
128 <li>
129 {% episode_link next podcast %}
130 </li>
131 {% endif %}
132 </ul>
133 </div>
135 {% endblock %}
138 {% block sidebar %}
140 {% if is_publisher %}
141 <div class="well">
142 <h4>{% trans "Publisher Pages" %}</h4>
144 <a class="btn" href="{% episode_link_target episode podcast "episode-publisher-detail" %}"><i class="icon-wrench"></i> {% trans "Go" %}</a>
145 </div>
146 {% endif %}
149 <div class="well">
151 <h4>Share</h4>
153 {% google_plus_one_button %}
154 {% fb_like_episode episode podcast %}
156 {% if can_flattr %}
157 <a href="{% episode_link_target episode podcast "flattr-episode" %}">
158 <img src="https://api.flattr.com/button/flattr-badge-large.png"
159 alt="Flattr {{ episode.title|default:"Unnamed Episode"|striptags }}" />
160 </a>
161 {% endif %}
163 </div>
167 {% if user.is_authenticated or chapters %}
168 <div class="well">
170 <h4>{% trans "Chapters" %}</h4>
172 <table class="list">
173 <tr>
174 <th></th>
175 <th>{% trans "Ad?" %}</th>
176 <th>{% trans "Label" %}</th>
177 <th></td>
178 </tr>
180 {% for chapter in chapters %}
181 <tr {% if chapter.is_own %}class="own-chapter"{% endif %} >
182 <td>{{ chapter.start|sec_to_time|time:"H:i:s" }}{% if chapter.start != chapter.end %} - {{ chapter.end|sec_to_time|time:"H:i:s" }}{% endif %}</td>
183 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
184 <td>{{ chapter.label }}</strong>
185 <td>
186 {% if chapter.is_own %}
187 <a href="{% episode_link_target episode "remove-chapter" chapter.start chapter.end %}">
188 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
189 </a>
190 {% endif %}
191 </td>
192 </tr>
193 {% endfor %}
194 {% if user.is_authenticated %}
195 <tr>
196 <form class="form-inline" action="{% episode_link_target episode podcast "add-chapter" %}" method="POST">
197 {% csrf_token %}
198 <td>
199 <input class="input-mini" type="text" name="start" id="start" class="time" placeholder="h:mm:ss"/>
200 <input class="input-mini" type="text" name="end" id="end" class="time" placeholder="h:mm:ss"/>
201 </td>
202 <td>
203 <input type="checkbox" name="advertisement" />
204 </td>
205 <td>
206 <input class="input-mini" type="text" name="label" />
207 </td>
208 <td>
209 <input class="btn" type="submit" value="{% trans "Add" %}" />
210 </td>
211 </form>
212 </tr>
213 {% endif %}
214 </table>
215 </div>
216 {% endif %}
218 {% if user.is_authenticated or history %}
219 <div class="well">
220 <h4>{% trans "History" %}</h4>
221 <table class="list">
222 <tr>
223 <th>{% trans "Time" %}</th>
224 <th>{% trans "Action" %}</th>
225 <th>{% trans "Device" %}</th>
226 <th></th>
227 </tr>
229 {% for s in history %}
230 <tr>
231 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
232 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
233 <td>
234 {% if s.device %}
235 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
236 {% endif %}
237 </td>
238 <td>{% if s.started or s.playmark %}{{s.started|format_time }} - {% endif %}
239 {% if s.playmark %}{{ s.playmark|format_time }}{% endif %}
240 </td>
241 </tr>
242 {% endfor %}
244 {% if user.is_authenticated %}
245 <tr>
246 <form action="{% episode_link_target episode podcast "add-episode-action" %}" method="POST">
247 {% csrf_token %}
248 <td>
249 <input class="input-mini" type="text" id="timestamp" name="timestamp" placeholder="empty = now" /></td>
250 <td>
251 <select class="input-mini" name="action">
252 {% for action, str in actions %}
253 <option value="{{ action }}">{{ str }}</option>
254 {% endfor %}
255 </select>
256 </td>
257 <td>
258 <select class="input-mini" name="device">
259 <option value=""></option>
260 {% for device_id, name in devices.items %}
261 <option value="{{ device_id }}">{{ name }}</option>
262 {% endfor %}
263 </select>
264 </td>
265 <td>
266 <input class="btn" type="submit" value="{% trans "Add" %}" />
267 </td>
268 </form>
269 </tr>
270 {% endif %}
271 </table>
272 </div>
273 {% endif %}
275 {% endblock %}
278 {% block javascript %}
279 <script type="text/javascript">
281 {% if episode.url|is_youtube_video %}
282 {% embed_youtube_video podcast episode user %}
283 {% endif %}
285 </script>
286 {% endblock javascript %}
289 {% block ads %}
290 {% comment %}disable ads on episode pages{% endcomment %}
291 {% endblock %}