da6f7cd0815c0b94f9f74c76461c8095f0e31cb3
[mygpo.git] / mygpo / web / templates / episode.html
blobda6f7cd0815c0b94f9f74c76461c8095f0e31cb3
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 %}
15 {% load static %}
17 {% load menu %}
18 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
19 {% block sectionmenu %}
20 {% if podcast.title %}
21 {{ "/podcast/"|section_menu:podcast.title }}
22 {% else %}
23 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
24 {% endif %}
25 {% endblock %}
27 {% block head %}
28 {% if episode.url|is_youtube_video %}
29 <script type="text/javascript" src="{% static "js/swfobject.js" %}"></script>
30 <script type="text/javascript" src="{% static "js/json2.js" %}"></script>
31 <script type="text/javascript" src="{% static "js/youtube-handler.js" %}"></script>
32 {% endif %}
33 {% opengraph_episode episode podcast %}
34 {% google_plus_one_head %}
36 {% endblock head %}
38 {% block title %}{{ episode.title|default:"Unnamed Episode"|striptags }} - {{ podcast.title|default:"Unnamed Podcast"|striptags}}{% endblock %}
40 {% block header %}
42 {% if podcast.logo_url %}
43 <div id="podcastlogo"><a href="{% podcast_link_target podcast %}">{{ podcast|podcast_logo_big }}</a></div>
44 {% endif %}
45 <h1>
46 {{ episode.title|default:"Unnamed Episode"|striptags }}
47 {% if episode.released %}
48 <small>{{ episode.released|naturalday }}</small>
49 {% endif %}
50 </h1>
51 <small class="description">
52 {% trans "from" %} {% podcast_group_link podcast %}&middot;
53 {% if not episode.outdated or "hide-outdated-urls" not in podcast.restrictions %}
54 <a href="{{episode.url}}" title="{% trans "Download" %}">
55 <i class="icon-download"></i>
56 </a>
57 {% endif %}
58 {% if episode.link and episode.link != episode.url %}&middot;
59 <a href="{{episode.link}}" title="{% trans "Website" %}">
60 <i class="icon-external-link"></i>
61 </a>
62 {% endif %}
63 {% if episode.listeners %}&middot;
64 {{ episode.listeners }} {% trans "listeners" %}
65 {% endif %}
66 </small>
68 {% endblock %}
72 {% block content %}
74 {% if episode.content or episode.description %}
75 <div class="description" {% if episode.language or podcast.language %}lang="{% firstof episode.language podcast.language %}"{% endif %}>
76 {% if episode.content %}
77 {{ episode.content|markdown }}
78 {% else %}
79 {{ episode.description|markdown }}
80 {% endif %}
81 </div>
82 {% endif %}
84 {% if episode.url|is_youtube_video %}
85 <div id="ytapiplayer">
86 You need Flash player 8+ and JavaScript enabled to view this video.
87 </div>
88 {% endif %}
91 {% if episode.url|is_flickr_photo %}
92 {{ episode|embed_flickr_photo }}
93 {% endif %}
95 {% if episode|is_image %}
96 <img src="{{ episode.url }}" />
97 {% endif %}
99 {% if user.is_authenticated %}
101 {% if is_favorite %}
102 <a class="btn" href="{% episode_link_target episode podcast "episode-fav" %}">
103 <i class="icon-star"></i> {% trans "Remove Favorite" %}
104 </a>
105 {% else %}
106 <a class="btn" href="{% episode_link_target episode podcast "episode-fav" %}">
107 <i class="icon-star-empty"></i> {% trans "Favorite" %}
108 </a>
109 {% endif %}
111 {% if played_parts %}
112 <h3>Already played</h3>
113 {{ played_parts|episode_heatmap_visualization }}
114 {% endif %}
116 {% endif %}
118 <div class="pagination">
119 <ul>
120 {% if prev %}
121 <li>
122 {% episode_link prev podcast %}
123 </li>
124 {% endif %}
125 <li>
126 <a href="{% podcast_link_target podcast %}#episodes">{% trans "..." %}</a>
127 </li>
128 {% if next %}
129 <li>
130 {% episode_link next podcast %}
131 </li>
132 {% endif %}
133 </ul>
134 </div>
136 {% endblock %}
139 {% block sidebar %}
141 {% if is_publisher %}
142 <div class="well">
143 <h4>{% trans "Publisher Pages" %}</h4>
145 <a class="btn" href="{% episode_link_target episode podcast "episode-publisher-detail" %}"><i class="icon-wrench"></i> {% trans "Go" %}</a>
146 </div>
147 {% endif %}
150 <div class="well">
152 <h4>Share</h4>
154 {% google_plus_one_button %}
155 {% fb_like_episode episode podcast %}
157 {% if can_flattr %}
158 <a href="{% episode_link_target episode podcast "flattr-episode" %}">
159 <img src="https://api.flattr.com/button/flattr-badge-large.png"
160 alt="Flattr {{ episode.title|default:"Unnamed Episode"|striptags }}" />
161 </a>
162 {% endif %}
164 </div>
168 {% if user.is_authenticated or chapters %}
169 <div class="well">
171 <h4>{% trans "Chapters" %}</h4>
173 <table class="list">
174 <tr>
175 <th></th>
176 <th>{% trans "Ad?" %}</th>
177 <th>{% trans "Label" %}</th>
178 <th></td>
179 </tr>
181 {% for chapter in chapters %}
182 <tr {% if chapter.is_own %}class="own-chapter"{% endif %} >
183 <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>
184 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
185 <td>{{ chapter.label }}</strong>
186 <td>
187 {% if chapter.is_own %}
188 <a href="{% episode_link_target episode "remove-chapter" chapter.start chapter.end %}">
189 <img src="{% static "unsubscribe.png" %}" alt="{% trans "Remove" %}" />
190 </a>
191 {% endif %}
192 </td>
193 </tr>
194 {% endfor %}
195 {% if user.is_authenticated %}
196 <tr>
197 <form class="form-inline" action="{% episode_link_target episode podcast "add-chapter" %}" method="POST">
198 {% csrf_token %}
199 <td>
200 <input class="input-mini" type="text" name="start" id="start" class="time" placeholder="h:mm:ss"/>
201 <input class="input-mini" type="text" name="end" id="end" class="time" placeholder="h:mm:ss"/>
202 </td>
203 <td>
204 <input type="checkbox" name="advertisement" />
205 </td>
206 <td>
207 <input class="input-mini" type="text" name="label" />
208 </td>
209 <td>
210 <input class="btn" type="submit" value="{% trans "Add" %}" />
211 </td>
212 </form>
213 </tr>
214 {% endif %}
215 </table>
216 </div>
217 {% endif %}
219 {% if user.is_authenticated or history %}
220 <div class="well">
221 <h4>{% trans "History" %}</h4>
222 <table class="list">
223 <tr>
224 <th>{% trans "Time" %}</th>
225 <th>{% trans "Action" %}</th>
226 <th>{% trans "Device" %}</th>
227 <th></th>
228 </tr>
230 {% for s in history %}
231 <tr>
232 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
233 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
234 <td>
235 {% if s.device %}
236 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
237 {% endif %}
238 </td>
239 <td>{% if s.started or s.playmark %}{{s.started|format_time }} - {% endif %}
240 {% if s.playmark %}{{ s.playmark|format_time }}{% endif %}
241 </td>
242 </tr>
243 {% endfor %}
245 {% if user.is_authenticated %}
246 <tr>
247 <form action="{% episode_link_target episode podcast "add-episode-action" %}" method="POST">
248 {% csrf_token %}
249 <td>
250 <input class="input-mini" type="text" id="timestamp" name="timestamp" placeholder="empty = now" /></td>
251 <td>
252 <select class="input-mini" name="action">
253 {% for action, str in actions %}
254 <option value="{{ action }}">{{ str }}</option>
255 {% endfor %}
256 </select>
257 </td>
258 <td>
259 <select class="input-mini" name="device">
260 <option value=""></option>
261 {% for device_id, name in devices.items %}
262 <option value="{{ device_id }}">{{ name }}</option>
263 {% endfor %}
264 </select>
265 </td>
266 <td>
267 <input class="btn" type="submit" value="{% trans "Add" %}" />
268 </td>
269 </form>
270 </tr>
271 {% endif %}
272 </table>
273 </div>
274 {% endif %}
276 {% endblock %}
279 {% block javascript %}
280 <script type="text/javascript">
282 {% if episode.url|is_youtube_video %}
283 {% embed_youtube_video podcast episode user %}
284 {% endif %}
286 </script>
287 {% endblock javascript %}
290 {% block ads %}
291 {% comment %}disable ads on episode pages{% endcomment %}
292 {% endblock %}