Merge branch 'master' into flattr
[mygpo.git] / mygpo / web / templates / episode.html
blob99fa578542b0063d3d29480a9f267c314b9abf9d
1 {% extends "base.html" %}
2 {% load url from future %}
3 {% load i18n %}
4 {% load humanize %}
5 {% load episodes %}
6 {% load devices %}
7 {% load podcasts %}
8 {% load mygpoutil %}
9 {% load time %}
10 {% load youtube %}
11 {% load flickr %}
12 {% load facebook %}
13 {% load google %}
14 {% load charts %}
15 {% load utils %}
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="/media/js/swfobject.js"></script>
30 <script type="text/javascript" src="/media/js/json2.js"></script>
31 <script type="text/javascript" src="/media/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 <div class="well">
143 <h4>Share</h4>
145 {% google_plus_one_button %}
146 {% fb_like_episode episode podcast %}
148 {% if episode.flattr_url %}
149 <a href="{% episode_link_target episode podcast "flattr-episode" %}">
150 <img src="https://api.flattr.com/button/flattr-badge-large.png"
151 alt="Flattr {{ episode.title|default:"Unnamed Episode"|striptags }}" />
152 </a>
153 {% endif %}
155 </div>
159 {% if user.is_authenticated or chapters %}
160 <div class="well">
162 <h4>{% trans "Chapters" %}</h4>
164 <table class="list">
165 <tr>
166 <th></th>
167 <th>{% trans "Ad?" %}</th>
168 <th>{% trans "Label" %}</th>
169 <th></td>
170 </tr>
172 {% for chapter in chapters %}
173 <tr {% if chapter.is_own %}class="own-chapter"{% endif %} >
174 <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>
175 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
176 <td>{{ chapter.label }}</strong>
177 <td>
178 {% if chapter.is_own %}
179 <a href="{% episode_link_target episode "remove-chapter" chapter.start chapter.end %}">
180 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
181 </a>
182 {% endif %}
183 </td>
184 </tr>
185 {% endfor %}
186 {% if user.is_authenticated %}
187 <tr>
188 <form class="form-inline" action="{% episode_link_target episode podcast "add-chapter" %}" method="POST">
189 {% csrf_token %}
190 <td>
191 <input class="input-mini" type="text" name="start" id="start" class="time" placeholder="h:mm:ss"/>
192 <input class="input-mini" type="text" name="end" id="end" class="time" placeholder="h:mm:ss"/>
193 </td>
194 <td>
195 <input type="checkbox" name="advertisement" />
196 </td>
197 <td>
198 <input class="input-mini" type="text" name="label" />
199 </td>
200 <td>
201 <input class="btn" type="submit" value="{% trans "Add" %}" />
202 </td>
203 </form>
204 </tr>
205 {% endif %}
206 </table>
207 </div>
208 {% endif %}
210 {% if user.is_authenticated or history %}
211 <div class="well">
212 <h4>{% trans "History" %}</h4>
213 <table class="list">
214 <tr>
215 <th>{% trans "Time" %}</th>
216 <th>{% trans "Action" %}</th>
217 <th>{% trans "Device" %}</th>
218 <th></th>
219 </tr>
221 {% for s in history %}
222 <tr>
223 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
224 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
225 <td>
226 {% if s.device %}
227 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
228 {% endif %}
229 </td>
230 <td>{% if s.started or s.playmark %}{{s.started|format_time }} - {% endif %}
231 {% if s.playmark %}{{ s.playmark|format_time }}{% endif %}
232 </td>
233 </tr>
234 {% endfor %}
236 {% if user.is_authenticated %}
237 <tr>
238 <form action="{% episode_link_target episode podcast "add-episode-action" %}" method="POST">
239 {% csrf_token %}
240 <td>
241 <input class="input-mini" type="text" id="timestamp" name="timestamp" placeholder="empty = now" /></td>
242 <td>
243 <select class="input-mini" name="action">
244 {% for action, str in actions %}
245 <option value="{{ action }}">{{ str }}</option>
246 {% endfor %}
247 </select>
248 </td>
249 <td>
250 <select class="input-mini" name="device">
251 <option value=""></option>
252 {% for device_id, name in devices.items %}
253 <option value="{{ device_id }}">{{ name }}</option>
254 {% endfor %}
255 </select>
256 </td>
257 <td>
258 <input class="btn" type="submit" value="{% trans "Add" %}" />
259 </td>
260 </form>
261 </tr>
262 {% endif %}
263 </table>
264 </div>
265 {% endif %}
267 {% endblock %}
270 {% block javascript %}
271 <script type="text/javascript">
273 {% if episode.url|is_youtube_video %}
274 {% embed_youtube_video podcast episode user %}
275 {% endif %}
277 </script>
278 {% endblock javascript %}
281 {% block ads %}
282 {% comment %}disable ads on episode pages{% endcomment %}
283 {% endblock %}