use new style {% url "view" %} template syntax
[mygpo.git] / mygpo / web / templates / podcast.html
blobde5358368210201316c49604b50b434c4b0196f7
1 {% extends "base.html" %}
2 {% load url from future %}
3 {% load i18n %}
4 {% load humanize %}
5 {% load episodes %}
6 {% load podcasts %}
7 {% load devices %}
8 {% load charts %}
9 {% load facebook %}
10 {% load google %}
11 {% load utils %}
13 {% load menu %}
14 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
15 {% block sectionmenu %}
16 {% if podcast.title %}
17 {{ "/podcast/"|section_menu:podcast.title }}
18 {% else %}
19 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
20 {% endif %}
21 {% endblock %}
23 {% block head %}
24 {{ podcast|opengraph_podcast }}
25 {% google_plus_one_head %}
26 {% endblock %}
28 {% block title %}{{ podcast.title|default:"Unnamed Podcast"|striptags }}{% endblock %}
30 {% block header %}
32 {% if podcast.logo_url %}
33 <div id="podcastlogo">{{ podcast|podcast_logo_big }}</div>
34 {% endif %}
36 <h1>
37 {% if podcast.title %}
38 {{ podcast.title|striptags }}
39 {% else %}
40 {% trans "Unnamed Podcast" %}
41 {%endif%}
42 </h1>
44 <small class="description">
45 {% trans "links" %}:
46 <a href="{{podcast.url}}">
47 {% trans "feed" %}
48 </a>
49 {% if podcast.link %},
50 <a href="{{podcast.link}}">{% trans "website" %}</a>
51 {% endif %},
52 {% blocktrans with podcast.subscriber_count as subscriber_count and podcast.listener_count as listener_count %}{{subscriber_count}} subscribers, {{listener_count}} listeners{% endblocktrans %}
53 </small>
55 {% if related_podcasts %}
56 <div class="related-podcasts">
57 <strong>{% trans "Also available" %}</strong>
58 {% for p in related_podcasts %}
59 {% podcast_group_link p p.group_member_name %}
60 {% endfor %}
61 </div>
62 {% endif %}
64 {% if podcast.description %}
65 <div class="description">{{ podcast.description|markdown }}</div>
66 {% endif %}
68 {% endblock %}
72 {% block content %}
74 {% if episode %}
75 <div class="first-episode">
77 <h2>{{ episode.title }} <small>{{ episode.released|naturalday }}</small></h2>
78 <div class="description">
79 {{ episode.description|default:""|truncatewords:"100"|markdown }}
80 </div>
81 <a href="{% episode_link_target episode podcast %}">more...</a>
83 </div>
84 {% endif %}
86 {% if episodes %}
88 <h3>{% trans "Older Episodes" %}</h3>
89 <table class="list episode_list" id="episodes">
90 <tr>
91 <th></th>
92 <th>{% trans "Title" %}</th>
93 <th>{% trans "Released" %}</th>
94 <th>{% trans "Listeners" %}</th>
95 </tr>
97 {% for episode in episodes %}
98 <tr>
99 <td>{{ episode.action|episode_status_icon }}</td>
100 <td class="short">
101 <div class="title">{% episode_link episode podcast %}</div>
102 <div class="description short">{{ episode.description|default:""|truncatewords:"20"|markdown|striptags }}</div>
103 </td>
104 <td>{{ episode.released|default:""|date:"Y-m-d" }}</td>
105 <td>
106 {% if episode.listeners %}
107 {% vertical_bar episode.listeners max_listeners %}
108 {% endif %}
109 </td>
110 </tr>
111 {% endfor %}
113 <tr>
114 <td></td>
115 <td>
116 <a href="{% podcast_link_target podcast "podcast-all-episodes" %}">{% trans "All Episodes" %}</a>
117 </td>
118 <td></td>
119 <td></td>
120 </tr>
122 </table>
123 {% endif %}
125 {% endblock %}
128 {% block sidebar %}
130 <div class="well">
131 <h4>{% trans "Subscriptions" %}</h4>
132 {% if not user.is_authenticated %}
133 <div class="subscribe">
134 <a href="{% podcast_link_target podcast "subscribe" %}">
135 <img src="/media/subscribe.png" style="vertical-align: middle;" alt=""/>
136 {% trans "Subscribe to this podcast" %}
137 </a>
138 </div>
139 {% endif %}
141 {% if devices or can_subscribe %}
142 <table class="list">
143 {% for device in devices %}
144 <tr>
145 <td>
146 {{ device|device_icon }}
147 <a href="{% url "device" device.uid %}">{{ device.name|striptags }}</a>
148 </td>
149 <td style="text-align: center;">
150 <form class="form-inline" method="post" action="{% podcast_link_target podcast "unsubscribe" device.uid %}?return_to={% podcast_link_target podcast %}">
151 {% csrf_token %}
152 <button class="btn btn-danger btn-small" type="submit">
153 <i class="icon-remove"></i>
154 </button>
155 </form>
156 </td>
157 </tr>
158 {% endfor %}
159 {% if can_subscribe %}
160 <tr>
161 <form class="form-inline" action="{% podcast_link_target podcast "subscribe" %}" method="post">
162 <td>
163 {% csrf_token %}
164 <select name="targets" id="id_targets">
165 {% for device in subscribe_targets %}
166 <option value="{{ device.uid }}">{{ device.name }}</option>
167 {% endfor %}
168 </select>
169 </td>
170 <td>
171 <button class="btn btn-success btn-small" type="submit">
172 <i class="icon-ok"></i>
173 </button>
174 </td>
175 </form>
176 </tr>
177 {% endif %}
178 </table>
179 {% endif %}
181 </div>
184 <div class="well">
185 <h4>Tags</h4>
187 {% for tag in tags %}
188 {% spaceless %}
189 {% if tag.is_own %}
190 <span class="own">{{ tag.tag }} <a class="remove" href="{% podcast_link_target podcast "remove-tag" %}?tag={{ tag.tag }}">X</a></span>
191 {% else %}
192 <span class="other">{{ tag.tag }}</span>
193 {% endif %}
194 {% if not forloop.last %}
195 <span class="seperator">,</span>
196 {% endif %}
197 {% endspaceless %}
198 {% endfor %}
200 {% if user.is_authenticated %}
201 <form class="form-inline" action="{% podcast_link_target podcast "add-tag" %}">
202 <div class="input-prepend btn-append">
203 <span class="add-on"><i class="icon-tag"></i></span><input class="input-small" type="text" name="tag" /><button class="btn btn-success" type="submit">
204 <i class="icon-plus"></i>
205 </button>
206 </div>
207 </form>
208 {% endif %}
209 </div>
211 <div class="well">
212 <h4>{% trans "Share" %}</h4>
214 {% google_plus_one_button %}
215 {{ podcast|fb_like_podcast }}
217 </div>
220 {% if history %}
221 <div class="well">
222 <h4>{% trans "Subscription History" %}</h4>
223 <table class="list">
224 {% for s in history %}
225 <tr>
226 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
227 <td>{{ s|podcast_status_icon }}</td>
228 <td>
229 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
230 </td>
231 </tr>
232 {% endfor %}
233 </table>
234 </div>
235 {% endif %}
237 {% endblock %}
240 {% block ads %}
241 {% comment %}disable ads on podcast pages{% endcomment %}
242 {% endblock %}