refactoring in publisher and Podcast model code
[mygpo.git] / mygpo / web / templates / podcast.html
blob4af0967ab5afd5c35f927d292e3f92eaa02f7c0a
1 {% extends "base.html" %}
2 {% load i18n %}
3 {% load humanize %}
4 {% load episodes %}
5 {% load podcasts %}
6 {% load devices %}
7 {% load charts %}
9 {% load menu %}
10 {% block mainmenu %}{{ "/podcast/"|main_menu }}{% endblock %}
11 {% block sectionmenu %}
12 {% if podcast.title %}
13 {{ "/podcast/"|section_menu:podcast.title }}
14 {% else %}
15 {{ "/podcast/"|section_menu:"Unnamed Podcast" }}
16 {% endif %}
17 {% endblock %}
19 {% block title %}{{ podcast.title|default:"Unnamed Podcast"|striptags }}{% endblock %}
21 {% block content %}
22 {% if podcast.logo_url %}
23 <div id="podcastlogo">{{ podcast|podcast_logo_big }}</div>
24 {% endif %}
26 <h1>{% if podcast.title %}{{ podcast.title|striptags }}{% else %}{% trans "Unnamed Podcast" %}{%endif%}</h1>
27 <small class="description">
28 {% trans "links" %}:
29 <a href="{{podcast.url}}">{% trans "feed" %}</a>{% if podcast.link %}, <a href="{{podcast.link}}">{% trans "website" %}</a>
30 {% endif %},
31 {% trans "stats:" %} {% blocktrans with podcast.subscriber_count as subscriber_count and podcast.listener_count as listener_count %}{{subscriber_count}} subscribers, {{listener_count}} listeners{% endblocktrans %}
32 </small>
33 <hr style="clear: none;"/>
35 {% if related_podcasts %}
36 <div class="related-podcasts">
37 <strong>{% trans "Also available" %}</strong>
38 {% for p in related_podcasts %}
39 <a href="{% url podcast p.id %}">{{ p.group_member_name|striptags }}</a>
40 {% endfor %}
41 </div>
42 {% endif %}
44 {% if podcast.description %}
45 <p class="description">{{ podcast.description|striptags }}</p>
46 {% endif %}
48 {% if devices %}
49 <h2>{% trans "My Subscriptions" %}</h2>
51 {% if privacy_form %}
52 {% if success %}
53 <div class="success">{% trans "Your settings have been saved." %}</div>
54 {% endif %}
56 <form action="{% url podcast podcast.id %}" method="POST">
57 {% csrf_token %}
58 <p>{{ privacy_form.public }} {{ privacy_form.public.label_tag }}</p>
59 <input type="submit" value="Save" />
60 </form>
61 {% endif %}
62 {% endif %}
64 {% if not user.is_authenticated %}
65 <div class="subscribe"><a href="{% url subscribe podcast.id %}"><img src="/media/subscribe.png" style="vertical-align: middle;" alt=""/> {% trans "Subscribe to this podcast" %}</a></div>
66 {% endif %}
68 {% if devices or can_subscribe %}
69 <table class="list" id="subscribed-devices-list">
70 <tr>
71 <th>{% trans "Device" %}</th>
72 <th>{% trans "(Un)subscribe" %}</th>
73 </tr>
74 {% for device in devices %}
75 <tr>
76 <td>
77 {{ device|device_icon }}
78 <a href="{% url device device.id %}">{{ device|striptags }}</a>
79 </td>
80 <td style="text-align: center;">
81 <a href="{% url unsubscribe podcast.id device.id %}?return_to=/podcast/{{ podcast.id }}"><img src="/media/unsubscribe.png" alt="{% trans "Unsubscribe" %}" title="{% trans "Click here to unsubscribe" %}"/></a>
82 </td>
83 </tr>
84 {% endfor %}
85 {% if can_subscribe %}
86 <tr>
87 <form action="{% url subscribe podcast.id %}" method="post">
88 {% csrf_token %}
89 <td>{{ subscribe_form.as_p }}</td>
90 <td style="text-align: center;">
91 <input type="submit" class="subscribe" value="" />
92 </td>
93 </form>
94 </tr>
95 {% endif %}
97 </table>
98 {% endif %}
100 <div class="tag-list">
101 <h3>Tags</h3>
102 {% for tag in tags %}{% spaceless %}
103 {% if tag.is_own %}
104 <span class="own">{{ tag.tag }} <a class="remove" href="{% url remove-tag podcast.id %}?tag={{ tag.tag }}">X</a></span>
105 {% else %}
106 <span class="other">{{ tag.tag }}</span>
107 {% endif %}
108 {% if not forloop.last %}<span class="seperator">,</span>{% endif %}
109 {% endspaceless %}
110 {% endfor %}
111 {% if user.is_authenticated %}
112 <form action="/podcast/{{ podcast.id }}/add-tag">
113 <input type="text" name="tag" />
114 <input type="submit" value="Add" />
115 </form>
116 {% endif %}
117 </div>
120 {% if episodes %}
121 <hr/>
122 <table class="list episode_list">
123 <tr>
124 <th></th>
125 <th>{% trans "Episode" %}</th>
126 <th>{% trans "Released" %}</th>
127 <th>{% trans "Listeners" %}</th>
128 </tr>
130 {% for episode in episodes %}
131 <tr>
132 <td style="text-align: center; padding-left: 5px; padding-right: 5px;">{{ episode.action|episode_status_icon }}</td>
133 <td style="width: 500px;">
134 <p class="title"><a href="{% url episode episode.id %}">{{ episode.title|default:"Unknown Episode"|striptags }}</a></p>
135 <p class="description">{{ episode.description|default:""|striptags|truncatewords:"15" }}</p>
136 </td>
137 <td>{{ episode.timestamp|default:""|date:"Y-m-d" }}</td>
138 <td>
139 {% if episode.listener_count %}
140 {{ episode.listener_count|vertical_bar:max_listeners }}
141 {% endif %}
142 </td>
143 </tr>
144 {% endfor %}
145 </table>
146 {% endif %}
148 {% if history %}
149 <hr/>
150 <h2>{% trans "Subscription history" %}</h2>
151 <table class="list">
152 <tr>
153 <th>{% trans "Timestamp" %}</th>
154 <th>{% trans "Action" %}</th>
155 <th>{% trans "Devices" %}</th>
156 </tr>
157 {% for s in history %}
158 <tr>
159 <td><abbr title="{{ s.timestamp }}">{{ s.timestamp|naturalday }}</abbr></td>
160 <td>{{ s|podcast_status_icon }}</td>
161 <td>
162 <a href="{% url device s.device.id %}">{{ s.device|device_icon }} {{ s.device.name|striptags }}</a></td>
163 </tr>
164 {% endfor %}
165 </table>
166 {% endif %}
168 {% if not podcast.title %}
169 <div class="info"><strong>{% trans "Why Unnamed Podcast?" %}</strong> {% trans "Because we display names after we have fetched the information form the feed -- and this may take some time. Until this is completed, the podcast will simply be called this way." %}</div>
170 {% endif %}
172 {% endblock %}