add flattr buttons to podcast, episode pages
[mygpo.git] / mygpo / web / templates / podcast.html
blob8b47666113099e900ef29eaa5d259c6256b3b511
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 {% if podcast.author %}{% trans "by" %}
46 {{ podcast.author|striptags }}
47 {% endif %}
48 {% if podcast.twitter %}
49 <a href="https://twitter.com/{{ podcast.twitter|striptags }}"><i class="icon-twitter"></i></a>
50 {% endif %}&middot;
51 <a href="{{podcast.url}}" title="{% trans "Feed" %}">
52 <i class="icon-rss"></i>
53 </a>
54 {% if podcast.link %}&middot;
55 <a href="{{podcast.link}}" title="{% trans "Website" %}">
56 <i class="icon-external-link"></i>
57 </a>
58 {% endif %}
59 {% if podcast.subscriber_count %}&middot;
60 {{ podcast.subscriber_count }} {% trans "subscribers" %}
61 {% endif %}
62 </small>
64 {% if related_podcasts %}
65 <div class="related-podcasts">
66 <strong>{% trans "Also available" %}</strong>
67 {% for p in related_podcasts %}
68 {% if p.group_member_name != podcast.group_member_name %}
69 {% podcast_group_link p p.group_member_name %}
70 {% endif %}
71 {% endfor %}
72 </div>
73 {% endif %}
75 {% if podcast.description %}
76 <div class="description">
77 {{ podcast.description|markdown }}
78 </div>
79 {% endif %}
81 {% endblock %}
85 {% block content %}
87 {% if episode %}
88 <div class="first-episode">
90 <h2>{{ episode.title }} <small>{{ episode.released|naturalday }}</small></h2>
91 <div class="description">
92 {{ episode.description|default:""|truncatewords:"100"|markdown }}
93 </div>
94 <a href="{% episode_link_target episode podcast %}">more...</a>
96 </div>
97 {% endif %}
99 {% if episodes %}
101 <h3>{% trans "Older Episodes" %}</h3>
102 <table class="list episode_list" id="episodes">
103 <tr>
104 <th></th>
105 <th>{% trans "Title" %}</th>
106 <th>{% trans "Released" %}</th>
107 <th>{% trans "Listeners" %}</th>
108 </tr>
110 {% for episode in episodes %}
111 <tr>
112 <td>{{ episode.action|episode_status_icon }}</td>
113 <td class="short">
114 <div class="title">{% episode_link episode podcast %}</div>
115 <div class="description short">{{ episode.description|default:""|truncatewords:"20"|markdown|striptags }}</div>
116 </td>
117 <td>{{ episode.released|default:""|date:"Y-m-d" }}</td>
118 <td>
119 {% if episode.listeners %}
120 {% vertical_bar episode.listeners max_listeners %}
121 {% endif %}
122 </td>
123 </tr>
124 {% endfor %}
126 <tr>
127 <td></td>
128 <td>
129 <a href="{% podcast_link_target podcast "podcast-all-episodes" %}">{% trans "All Episodes" %}</a>
130 </td>
131 <td></td>
132 <td></td>
133 </tr>
135 </table>
136 {% endif %}
138 {% endblock %}
141 {% block sidebar %}
143 <div class="well">
144 <h4>{% trans "Subscriptions" %}</h4>
145 {% if not user.is_authenticated %}
146 <div class="subscribe">
147 <a href="{% podcast_link_target podcast "subscribe" %}">
148 <img src="/media/subscribe.png" style="vertical-align: middle;" alt=""/>
149 {% trans "Subscribe to this podcast" %}
150 </a>
151 </div>
152 {% endif %}
154 {% if devices or can_subscribe %}
155 <table class="list">
156 {% for device in devices %}
157 <tr>
158 <td>
159 {{ device|device_icon }}
160 <a href="{% url "device" device.uid %}">{{ device.name|striptags }}</a>
161 </td>
162 <td style="text-align: center;">
163 <form class="form-inline" method="post" action="{% podcast_link_target podcast "unsubscribe" device.uid %}?return_to={% podcast_link_target podcast %}">
164 {% csrf_token %}
165 <button class="btn btn-danger btn-small" type="submit">
166 <i class="icon-remove"></i>
167 </button>
168 </form>
169 </td>
170 </tr>
171 {% endfor %}
172 {% if can_subscribe %}
173 <tr>
174 <form class="form-inline" action="{% podcast_link_target podcast "subscribe" %}" method="post">
175 <td>
176 {% csrf_token %}
177 <select name="targets" id="id_targets">
178 {% for device in subscribe_targets %}
179 <option value="{{ device.uid }}">{{ device.name }}</option>
180 {% endfor %}
181 </select>
182 </td>
183 <td>
184 <button class="btn btn-success btn-small" type="submit">
185 <i class="icon-ok"></i>
186 </button>
187 </td>
188 </form>
189 </tr>
190 {% endif %}
191 </table>
192 {% endif %}
194 </div>
197 <div class="well">
198 <h4>Tags</h4>
200 {% for tag in tags %}
201 {% spaceless %}
202 {% if tag.is_own %}
203 <span class="own">{{ tag.tag }} <a class="remove" href="{% podcast_link_target podcast "remove-tag" %}?tag={{ tag.tag }}">X</a></span>
204 {% else %}
205 <span class="other">{{ tag.tag }}</span>
206 {% endif %}
207 {% if not forloop.last %}
208 <span class="seperator">,</span>
209 {% endif %}
210 {% endspaceless %}
211 {% endfor %}
213 {% if user.is_authenticated %}
214 <form class="form-inline" action="{% podcast_link_target podcast "add-tag" %}">
215 <div class="input-prepend btn-append">
216 <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">
217 <i class="icon-plus"></i>
218 </button>
219 </div>
220 </form>
221 {% endif %}
222 </div>
224 <div class="well">
225 <h4>{% trans "Share" %}</h4>
227 {% google_plus_one_button %}
228 {{ podcast|fb_like_podcast }}
229 {% if podcast.flattr_url %}
230 <a href="{{ podcast.flattr_url }}">
231 <img src="https://api.flattr.com/button/flattr-badge-large.png"
232 alt="Flattr {{ podcast.title|default:"Unnamed Podcast"|striptags }}" />
233 </a>
234 {% endif %}
236 </div>
239 {% if history %}
240 <div class="well">
241 <h4>{% trans "Subscription History" %}</h4>
242 <table class="list">
243 {% for s in history %}
244 <tr>
245 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
246 <td>{{ s|podcast_status_icon }}</td>
247 <td>
248 <a href="{% url "device" s.device.uid %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a>
249 </td>
250 </tr>
251 {% endfor %}
252 </table>
253 </div>
254 {% endif %}
256 {% endblock %}
259 {% block ads %}
260 {% comment %}disable ads on podcast pages{% endcomment %}
261 {% endblock %}