use new style {% url "view" %} template syntax
[mygpo.git] / mygpo / web / templates / episode.html
blob3f8f46c1fada697a20069c26ad8449719009954d
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 <small>{{ episode.released|naturalday }}</small>
48 </h1>
49 <small class="description">
50 {% trans "from" %} {% podcast_group_link podcast %},
51 {% trans "links" %}:
52 {% if not episode.outdated or "hide-outdated-urls" not in podcast.restrictions %}
53 <a href="{{episode.url}}">{% trans "download" %}</a>
54 {% endif %}
55 {% if episode.link and episode.link != episode.url %}
56 <a href="{{episode.link}}">{% trans "website" %}</a>
57 {% endif %},
58 {% trans "stats:" %} {% blocktrans with episode.listener_count as listener_count %}{{listener_count}} listeners{% endblocktrans %}
59 </small>
61 {% endblock %}
65 {% block content %}
67 {% if episode.content or episode.description %}
68 <div class="description">
69 {% if episode.content %}
70 {{ episode.content|markdown }}
71 {% else %}
72 {{ episode.description|markdown }}
73 {% endif %}
74 </div>
75 {% endif %}
77 {% if episode.url|is_youtube_video %}
78 <div id="ytapiplayer">
79 You need Flash player 8+ and JavaScript enabled to view this video.
80 </div>
81 {% endif %}
84 {% if episode.url|is_flickr_photo %}
85 {{ episode|embed_flickr_photo }}
86 {% endif %}
88 {% if episode|is_image %}
89 <img src="{{ episode.url }}" />
90 {% endif %}
92 {% if user.is_authenticated %}
94 {% if is_favorite %}
95 <a class="btn" href="{% episode_link_target episode podcast "episode-fav" %}">
96 <i class="icon-star"></i> {% trans "Remove Favorite" %}
97 </a>
98 {% else %}
99 <a class="btn" href="{% episode_link_target episode podcast "episode-fav" %}">
100 <i class="icon-star-empty"></i> {% trans "Favorite" %}
101 </a>
102 {% endif %}
104 {% if played_parts %}
105 <h3>Already played</h3>
106 {{ played_parts|episode_heatmap_visualization }}
107 {% endif %}
109 {% endif %}
111 <div class="pagination">
112 <ul>
113 {% if prev %}
114 <li>
115 {% episode_link prev podcast %}
116 </li>
117 {% endif %}
118 <li>
119 <a href="{% podcast_link_target podcast %}#episodes">{% trans "Episode-List" %}</a>
120 </li>
121 {% if next %}
122 <li>
123 {% episode_link next podcast %}
124 </li>
125 {% endif %}
126 </ul>
127 </div>
129 {% endblock %}
132 {% block sidebar %}
134 <div class="well">
136 <h4>Share</h4>
138 {% google_plus_one_button %}
139 {% fb_like_episode episode podcast %}
140 </div>
144 {% if user.is_authenticated or chapters %}
145 <div class="well">
147 <h4>{% trans "Chapters" %}</h4>
149 <table class="list">
150 <tr>
151 <th></th>
152 <th>{% trans "Ad?" %}</th>
153 <th>{% trans "Label" %}</th>
154 <th></td>
155 </tr>
157 {% for chapter in chapters %}
158 <tr {% if chapter.is_own %}class="own-chapter"{% endif %} >
159 <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>
160 <td>{% if chapter.advertisement %}Yes{% endif %}</td>
161 <td>{{ chapter.label }}</strong>
162 <td>
163 {% if chapter.is_own %}
164 <a href="{% episode_link_target episode "remove-chapter" chapter.start chapter.end %}">
165 <img src="/media/unsubscribe.png" alt="{% trans "Remove" %}" />
166 </a>
167 {% endif %}
168 </td>
169 </tr>
170 {% endfor %}
171 {% if user.is_authenticated %}
172 <tr>
173 <form class="form-inline" action="{% episode_link_target episode podcast "add-chapter" %}" method="POST">
174 {% csrf_token %}
175 <td>
176 <input type="text" name="start" id="start" class="time" placeholder="h:mm:ss"/> -
177 <input type="text" name="end" id="end" class="time" placeholder="h:mm:ss"/>
178 </td>
179 <td>
180 <input type="checkbox" name="advertisement" />
181 </td>
182 <td>
183 <input class="input-small" type="text" name="label" />
184 </td>
185 <td>
186 <input class="btn" type="submit" value="{% trans "Add" %}" />
187 </td>
188 </form>
189 </tr>
190 {% endif %}
191 </table>
192 </div>
193 {% endif %}
195 {% if user.is_authenticated or history %}
196 <div class="well">
197 <h4>{% trans "History" %}</h4>
198 <table class="list">
199 <tr>
200 <th>{% trans "Time" %}</th>
201 <th>{% trans "Action" %}</th>
202 <th>{% trans "Device" %}</th>
203 <th></th>
204 </tr>
206 {% for s in history %}
207 <tr>
208 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
209 <td style="text-align: center;">{{ s|episode_status_icon }}</td>
210 <td>
211 {% if s.device %}
212 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
213 {% endif %}
214 </td>
215 <td>{% if s.started or s.playmark %}{{s.started|format_time }} - {% endif %}
216 {% if s.playmark %}{{ s.playmark|format_time }}{% endif %}
217 </td>
218 </tr>
219 {% endfor %}
221 {% if user.is_authenticated %}
222 <tr>
223 <form action="{% episode_link_target episode podcast "add-episode-action" %}" method="POST">
224 {% csrf_token %}
225 <td>
226 <input class="input-small" type="text" id="timestamp" name="timestamp" placeholder="empty = now" /></td>
227 <td>
228 <select class="input-small" name="action">
229 {% for action, str in actions %}
230 <option value="{{ action }}">{{ str }}</option>
231 {% endfor %}
232 </select>
233 </td>
234 <td>
235 <select class="input-small" name="device">
236 <option value=""></option>
237 {% for device_id, name in devices.items %}
238 <option value="{{ device_id }}">{{ name }}</option>
239 {% endfor %}
240 </select>
241 </td>
242 <td>
243 <input class="btn" type="submit" value="{% trans "Add" %}" />
244 </td>
245 </form>
246 </tr>
247 {% endif %}
248 </table>
249 </div>
250 {% endif %}
252 {% endblock %}
255 {% block javascript %}
256 <script type="text/javascript">
258 {% if episode.url|is_youtube_video %}
259 {% embed_youtube_video podcast episode user %}
260 {% endif %}
262 </script>
263 {% endblock javascript %}
266 {% block ads %}
267 {% comment %}disable ads on episode pages{% endcomment %}
268 {% endblock %}