refactor / optimize device updates
[mygpo.git] / mygpo / share / templates / userpage.html
blob4b6b9518e8be5f18bb8d59f3cad0f7dd10b631b1
1 {% extends "base.html" %}
3 {% load i18n %}
4 {% load podcasts %}
5 {% load episodes %}
6 {% load charts %}
7 {% load math %}
8 {% load utils %}
9 {% load time %}
10 {% load gravatar %}
12 {% load menu %}
13 {% block mainmenu %}{{ "/share/"|main_menu }}{% endblock %}
14 {% block sectionmenu %}{{ "/share/me"|section_menu:page_user.username }}{% endblock %}
16 {% block title %}{{ page_user.username }}{% endblock %}
19 {% block header %}
20 <div id="podcastlogo">{% gravatar_img page_user %}</div>
22 <h1>{{ page_user.username }}</h1>
23 <small class="description">
24 {% blocktrans %}a user on {{ site }}{% endblocktrans %}
25 {% if page_user.twitter %}
26 · <a href="https://twitter/{{ page_user.twitter|striptags }}"><i class="icon-twitter"></i></a>
27 {% endif %}
28 {% if flattr_username %}
29 · <a href="https://flattr.com/profile/{{ flattr_username|striptags }}"><img src="https://flattr.com/_img/icons/flattr_logo_16.png" /></a>
30 {% endif %}
32 </small>
34 <div class="description">
35 {% if page_user.about %}
36 {{ page_user.about|markdown }}
37 {% else %}
38 {% blocktrans with page_user.username as username %}<strong>{{ username }}</strong> is sharing his favorite podcasts on {{ site }}.{% endblocktrans %}
39 {% endif %}
41 </div>
42 {% endblock %}
44 {% block content %}
46 <br style="clear: both;" />
48 {% if subscriptions and not subscriptions_token %}
50 <h2>{% blocktrans with subscriptions|length as subscription_count %}{{ subscription_count }} Subscriptions{% endblocktrans %}</h2>
51 <table class="list">
52 <tr>
53 <th></th>
54 <th></th>
55 <th>{% trans "Episodes Listened" %}</th>
56 </tr>
58 {% for podcast in subscriptions|slice:":5" %}
59 <tr>
60 <td>{{ podcast|podcast_logo }}</td>
61 <td class="listlink">{% podcast_group_link podcast %}</td>
62 <td>{% vertical_bar podcast.episodes_listened podcast.episode_count "ratio" %}</td>
63 </tr>
64 {% endfor %}
66 {% if subscriptions|length > 5 %}
67 <tr>
68 <td></td>
69 <td colspan="2">
70 <a href="{% url "shared-subscriptions" page_user.username %}">
71 {% trans "see all" %}
72 </a>
73 </td>
74 </tr>
75 {% endif %}
77 </table>
79 {% endif %}
84 {% if lists %}
86 <h2>{% blocktrans with lists|length as list_count %}{{ list_count }} Podcast Lists{% endblocktrans %}</h2>
87 <table class="list">
88 {% for list in lists|slice:":5" %}
89 <tr>
90 <td><a href="{% url "list-show" page_user.username list.slug %}">{{ list.title }}</a></td>
91 <td>{% blocktrans with list.podcasts|length as num_podcasts %}{{ num_podcasts }} Podcasts{% endblocktrans %}</td>
92 </tr>
93 {% endfor %}
95 {% if lists|length > 5 %}
96 <tr>
97 <td></td>
98 <td>
99 <a href="{% url "lists-user" page_user.username %}">
100 {% trans "see all" %}
101 </a>
102 </td>
103 </tr>
104 {% endif %}
106 </table>
108 {% endif %}
111 {% if recent_episodes %}
113 <h2>{% blocktrans with recent_episodes|length as num_episodes%}{{ num_episodes }} Recently Played Episodes{% endblocktrans %}</h2>
114 <table class="list">
115 {% for episode in recent_episodes %}
116 <tr>
117 <td>{{ episode.podcast|podcast_logo }}</td>
118 <td>
119 {% episode_link episode episode.podcast %}<br />
120 {% if episode.podcast %}
121 <span class="from_podcast">{% trans "from" %} {% podcast_group_link episode.podcast %}</td>
122 {% endif %}
123 </td>
124 </tr>
125 {% endfor %}
127 </table>
129 {% endif %}
132 {% if favorite_episodes and not favorite_feeds_token %}
134 <h2>{% blocktrans with favorite_episodes|length as num_fav_episodes %}{{ num_fav_episodes }} Favorite Episodes{% endblocktrans %}</h2>
135 <table class="list">
136 {% for episode in favorite_episodes|slice:":5" %}
137 <tr>
138 <td>{% if episode.podcast %}{{ episode.podcast|podcast_logo }}{% endif %}</td>
139 <td>{% episode_link episode episode.podcast %}<br/>
140 {% if episode.podcast %}
141 <span class="from_podcast">{% trans "from" %} {% podcast_group_link episode.podcast %}</td>
142 {% endif %}
143 </tr>
144 {% endfor %}
146 {% if favorite_episodes|length > 5 %}
147 <tr>
148 <td></td>
149 <td>
150 <a href="{% url "favorites-feed" page_user.username %}">
151 {% trans "see all" %}
152 </a>
153 </td>
154 </tr>
155 {% endif %}
157 </table>
159 {% endif %}
161 {% endblock %}
164 {% block sidebar %}
166 {% if user == page_user %}
168 <div class="well">
169 <h3>{% trans "That's You!" %}</h3>
171 <a href="{% url "account"%}" class="btn btn-primary">{% trans "Edit your profile" %}</a>
173 </div>
175 {% endif %}
178 <div class="well">
179 <h3>{% trans "Stats" %}</h3>
180 <ul>
181 <li>{% trans "Total Played:" %}
182 {% if seconds_played_total %}
183 {{ seconds_played_total|format_duration }} /
184 {% endif %}
185 {{ num_played_episodes_total }} {% trans "Episodes" %}
186 </li>
187 <li>{% trans "Played Last Month:" %}
188 {% if seconds_played_month %}
189 {{ seconds_played_month|format_duration }} /
190 {% endif %}
191 {{ num_played_episodes_month }} {% trans "Episodes" %}
192 </li>
193 <li>{% trans "Member Since:" %}
194 {% if user.date_joined.year > 2000 %}
195 {{ user.date_joined }}
196 {% else %}
197 {% trans "the early days" %}
198 {% endif %}
199 </li>
200 </ul>
201 </div>
203 {% endblock %}