Dot-Notation for MediaEntry.media_files
[mediagoblin.git] / mediagoblin / templates / mediagoblin / user_pages / user.html
1 {#
2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C) 2011 MediaGoblin contributors. See AUTHORS.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Affero General Public License for more details.
14 #
15 # You should have received a copy of the GNU Affero General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #}
18 {% extends "mediagoblin/base.html" %}
19
20 {% from "mediagoblin/utils/object_gallery.html" import object_gallery %}
21
22 {% block mediagoblin_head %}
23 <link rel="alternate" type="application/atom+xml"
24 href="{{ request.urlgen(
25 'mediagoblin.user_pages.atom_feed',
26 user=user.username) }}">
27 {% endblock mediagoblin_head %}
28
29 {% block title %}
30 {%- if user -%}
31 {%- trans username=user.username -%}
32 {{ username }}'s profile
33 {%- endtrans %} &mdash; {{ super() }}
34 {%- else -%}
35 {{ super() }}
36 {%- endif -%}
37 {% endblock %}
38
39
40 {% block mediagoblin_content -%}
41 {# If no user... #}
42 {% if not user %}
43 <p>{% trans %}Sorry, no such user found.{% endtrans %}<p/>
44
45 {# User exists, but needs verification #}
46 {% elif user.status == "needs_email_verification" %}
47 {% if user == request.user %}
48 {# this should only be visible when you are this user #}
49 <div class="grid_6 prefix_1 suffix_1 form_box">
50 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
51
52 <p>
53 {% trans -%}
54 Almost done! Your account still needs to be activated.
55 {%- endtrans %}
56 </p>
57 <p>
58 {% trans -%}
59 An email should arrive in a few moments with instructions on how to do so.
60 {%- endtrans %}
61 </p>
62 <p>{% trans %}In case it doesn't:{% endtrans %}</p>
63
64 <a href="{{ request.urlgen('mediagoblin.auth.resend_verification') }}"
65 class="button_action_highlight">{% trans %}Resend verification email{% endtrans %}</a>
66 </div>
67 {% else %}
68 {# if the user is not you, but still needs to verify their email #}
69 <div class="grid_6 prefix_1 suffix_1 form_box">
70 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
71
72 <p>
73 {% trans -%}
74 Someone has registered an account with this username, but it still has to be activated.
75 {%- endtrans %}
76 </p>
77
78 <p>
79 {% trans login_url=request.urlgen('mediagoblin.auth.login') -%}
80 If you are that person but you've lost your verification email, you can <a href="{{ login_url }}">log in</a> and resend it.
81 {%- endtrans %}
82 </p>
83 </div>
84 {% endif %}
85
86 {# Active(?) (or at least verified at some point) user, horray! #}
87 {% else %}
88 <h1>
89 {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
90 </h1>
91
92 {% if not user.url and not user.bio %}
93 {% if request.user._id == user._id %}
94 <div class="grid_6 alpha empty_space">
95 <p>
96 {% trans %}Here's a spot to tell others about yourself.{% endtrans %}
97 </p>
98 <a href="{{ request.urlgen('mediagoblin.edit.profile') }}?username={{
99 user.username }}"
100 class="button_action">
101 {%- trans %}Edit profile{% endtrans -%}
102 </a>
103 </div>
104 {% else %}
105 <div class="grid_6 alpha empty_space">
106 <p>
107 {% trans -%}
108 This user hasn't filled in their profile (yet).
109 {%- endtrans %}
110 </p>
111 </div>
112 {% endif %}
113 {% else %}
114 <div class="grid_6 alpha">
115 {% include "mediagoblin/utils/profile.html" %}
116 {% if request.user._id == user._id or request.user.is_admin %}
117 <a href="{{ request.urlgen('mediagoblin.edit.profile') }}?username={{
118 user.username }}">
119 {%- trans %}Edit profile{% endtrans -%}
120 </a>
121 {% endif %}
122 </div>
123 {% endif %}
124
125 {% if media_entries.count() %}
126 <div class="grid_10 omega">
127 {{ object_gallery(request, media_entries, pagination,
128 pagination_base_url=user_gallery_url, col_number=3) }}
129 {% include "mediagoblin/utils/object_gallery.html" %}
130 <div class="clear"></div>
131 <p>
132 <a href="{{ user_gallery_url }}">
133 {% trans username=user.username -%}
134 View all of {{ username }}'s media{% endtrans -%}
135 </a>
136 </p>
137 {% set feed_url = request.urlgen(
138 'mediagoblin.user_pages.atom_feed',
139 user=user.username) %}
140 {% include "mediagoblin/utils/feed_link.html" %}
141 </div>
142 {% else %}
143 {% if request.user._id == user._id %}
144 <div class="grid_10 omega empty_space">
145 <p>
146 {% trans -%}
147 This is where your media will appear, but you don't seem to have added anything yet.
148 {%- endtrans %}
149 </p>
150 <a class="button_action"
151 href="{{ request.urlgen('mediagoblin.submit.start') }}">
152 {%- trans %}Add media{% endtrans -%}
153 </a>
154 </div>
155 {% else %}
156 <div class="grid_10 omega empty_space">
157 <p>
158 {% trans -%}
159 There doesn't seem to be any media here yet...
160 {%- endtrans %}
161 </p>
162 </div>
163 {% endif %}
164 {% endif %}
165 <div class="clear"></div>
166 {% endif %}
167 {% endblock %}