Merge branch 'master' into flattr
[mygpo.git] / mygpo / web / templates / episode.html
bloba6fd379d1e670936b2807f7a6ae79d357cc76f42
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">
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 {% comment %} add flattr button if the user has his flattr-settings enabled{% endcomment %}
147 {% google_plus_one_button %}
148 {% fb_like_episode episode podcast %}
149 </div>
153 {% if user.is_authenticated or chapters %}
154 <div class="well">
156 <h4>{% trans "Chapters" %}</h4>
158 <table class="list">
159 <tr>
160 <th></th>
161 <th>{% trans "Ad?" %}</th>
162 <th>{% trans "Label" %}</th>
163 <th></td>
164 </tr>
166 {% for chapter in chapters %}
167 <tr {% if chapter.is_own %}class="own-chapter"{% endif %} >
168 <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>
169 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
170 <td>{{ chapter.label }}</strong>
171 <td>
172 {% if chapter.is_own %}
173 <a href="{% episode_link_target episode "remove-chapter" chapter.start chapter.end %}">
174 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
175 </a>
176 {% endif %}
177 </td>
178 </tr>
179 {% endfor %}
180 {% if user.is_authenticated %}
181 <tr>
182 <form class="form-inline" action="{% episode_link_target episode podcast "add-chapter" %}" method="POST">
183 {% csrf_token %}
184 <td>
185 <input type="text" name="start" id="start" class="time" placeholder="h:mm:ss"/> -
186 <input type="text" name="end" id="end" class="time" placeholder="h:mm:ss"/>
187 </td>
188 <td>
189 <input type="checkbox" name="advertisement" />
190 </td>
191 <td>
192 <input class="input-small" type="text" name="label" />
193 </td>
194 <td>
195 <input class="btn" type="submit" value="{% trans "Add" %}" />
196 </td>
197 </form>
198 </tr>
199 {% endif %}
200 </table>
201 </div>
202 {% endif %}
204 {% if user.is_authenticated or history %}
205 <div class="well">
206 <h4>{% trans "History" %}</h4>
207 <table class="list">
208 <tr>
209 <th>{% trans "Time" %}</th>
210 <th>{% trans "Action" %}</th>
211 <th>{% trans "Device" %}</th>
212 <th></th>
213 </tr>
215 {% for s in history %}
216 <tr>
217 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
218 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
219 <td>
220 {% if s.device %}
221 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
222 {% endif %}
223 </td>
224 <td>{% if s.started or s.playmark %}{{s.started|format_time }} - {% endif %}
225 {% if s.playmark %}{{ s.playmark|format_time }}{% endif %}
226 </td>
227 </tr>
228 {% endfor %}
230 {% if user.is_authenticated %}
231 <tr>
232 <form action="{% episode_link_target episode podcast "add-episode-action" %}" method="POST">
233 {% csrf_token %}
234 <td>
235 <input class="input-small" type="text" id="timestamp" name="timestamp" placeholder="empty = now" /></td>
236 <td>
237 <select class="input-small" name="action">
238 {% for action, str in actions %}
239 <option value="{{ action }}">{{ str }}</option>
240 {% endfor %}
241 </select>
242 </td>
243 <td>
244 <select class="input-small" name="device">
245 <option value=""></option>
246 {% for device_id, name in devices.items %}
247 <option value="{{ device_id }}">{{ name }}</option>
248 {% endfor %}
249 </select>
250 </td>
251 <td>
252 <input class="btn" type="submit" value="{% trans "Add" %}" />
253 </td>
254 </form>
255 </tr>
256 {% endif %}
257 </table>
258 </div>
259 {% endif %}
261 {% endblock %}
264 {% block javascript %}
265 <script type="text/javascript">
267 {% if episode.url|is_youtube_video %}
268 {% embed_youtube_video podcast episode user %}
269 {% endif %}
271 </script>
272 {% endblock javascript %}
275 {% block ads %}
276 {% comment %}disable ads on episode pages{% endcomment %}
277 {% endblock %}