Improving the whitespace around the {% trans %} adjustments from tilly-q
[mediagoblin.git] / mediagoblin / templates / mediagoblin / moderation / user.html
1 {#
2 # GNU MediaGoblin -- federated, autonomous media hosting
3 # Copyright (C) 2011, 2012 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 {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
20
21 {% block title %}
22 {%- if user -%}
23 {%- trans username=user.username -%}
24 User: {{ username }}
25 {%- endtrans %} &mdash; {{ super() }}
26 {%- else -%}
27 {{ super() }}
28 {%- endif -%}
29 {% endblock %}
30
31 {%- block mediagoblin_head %}
32 <script src="{{ request.staticdirect('/js/setup_report_forms.js') }}">
33 </script>
34 {% endblock %}
35
36 {% block mediagoblin_content -%}
37 {# If no user... #}
38 {% if not user %}
39 <p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
40 {# User exists, but needs verification #}
41 {% elif not user.has_privilege('active') %}
42 <div class="profile_sidebar empty_space">
43 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
44 <p>
45 {% trans -%}
46 Someone has registered an account with this username, but it still has
47 to be activated.
48 {%- endtrans %}
49 </p>
50
51 </div>
52
53 {# Active(?) (or at least verified at some point) user, horray! #}
54 {% else %}
55 <a href="{{ request.urlgen('mediagoblin.moderation.users') }}"
56 class="return_to_panel button_action"
57 title="Return to Users Panel">
58 {% trans %}Return to Users Panel{% endtrans %}</a>
59 <h1>
60 {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
61 {% if user_banned and user_banned.expiration_date %}
62 &mdash; {% trans expiration_date=user_banned.expiration_date -%}
63 BANNED until {{ expiration_date }}
64 {%- endtrans %}
65 {% elif user_banned %}
66 &mdash; {% trans %}Banned Indefinitely{% endtrans %}
67 {% endif %}
68 </h1>
69 {% if not user.url and not user.bio %}
70 <div class="profile_sidebar empty_space">
71 <p>
72 {% trans -%}
73 This user hasn't filled in their profile (yet).
74 {%- endtrans %}
75 </p>
76 {% else %}
77 <div class="profile_sidebar">
78 {% include "mediagoblin/utils/profile.html" %}
79 {% if request.user and
80 (request.user.id == user.id or request.user.has_privilege('admin')) %}
81 <a href="{{ request.urlgen('mediagoblin.edit.profile',
82 user=user.username) }}">
83 {%- trans %}Edit profile{% endtrans -%}
84 </a>
85 {% endif %}
86 {% endif %}
87 <p>
88 <a href="{{ request.urlgen('mediagoblin.user_pages.collection_list',
89 user=user.username) }}">
90 {%- trans %}Browse collections{% endtrans -%}
91 </a>
92 </p>
93 </div>
94 {% endif %}
95 {% if user %}
96 <h2>
97 {%- trans username=user.username -%}
98 Active Reports on {{ username }}
99 {%- endtrans -%}
100 </h2>
101 {% if reports.count() %}
102 <table class="admin_side_panel">
103 <tr>
104 <th>{%- trans %}Report ID{% endtrans -%}</th>
105 <th>{%- trans %}Reported Content{% endtrans -%}</th>
106 <th>{%- trans %}Description of Report{% endtrans -%}</th>
107 </tr>
108 {% for report in reports %}
109 <tr>
110 <td>
111 <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
112 <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
113 report_id=report.id) }}">
114 {%- trans report_number=report.id -%}
115 Report #{{ report_number }}
116 {%- endtrans -%}
117 </a>
118 </td>
119 <td>
120 {% if report.discriminator == "comment_report" %}
121 <a>{%- trans %}Reported Comment{% endtrans -%}</a>
122 {% elif report.discriminator == "media_report" %}
123 <a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
124 {% endif %}
125 </td>
126 <td>{{ report.report_content[:21] }}
127 {% if report.report_content|count >20 %}...{% endif %}</td>
128 <td>{%- trans %}Resolve{% endtrans -%}</td>
129 </tr>
130 {% endfor %}
131 <tr><td></td><td></td>
132 </table>
133 {% else %}
134 {%- trans username=user.username -%}
135 No active reports filed on {{ username }}
136 {%- endtrans -%}
137 {% endif %}
138 <span class="right_align">
139 <a href="{{ request.urlgen(
140 'mediagoblin.moderation.reports') }}?reported_user={{user.id}}">
141 {%- trans
142 username=user.username %}All reports on {{ username }}{% endtrans %}</a>
143 &middot;
144 <a href="{{ request.urlgen(
145 'mediagoblin.moderation.reports') }}?reporter={{user.id}}">
146 {%- trans username=user.username -%}
147 All reports that {{ username }} has filed
148 {%- endtrans %}</a>
149 </span>
150 <span class=clear></span>
151 <h2>{{ user.username }}'s Privileges</h2>
152 <form method=POST action="{{ request.urlgen(
153 'mediagoblin.moderation.ban_or_unban',
154 user=user.username) }}" class="right_align">
155 {{ csrf_token }}
156 {% if request.user.has_privilege('admin') and not user_banned and
157 not user.id == request.user.id %}
158 {{ wtforms_util.render_divs(ban_form) }}
159 <input type=submit class="button_action"
160 value="{% trans %}Ban User{% endtrans %}"
161 id="ban_user_submit" />
162 {% elif request.user.has_privilege('admin') and
163 not user.id == request.user.id %}
164 <input type=submit class="button_action right_align"
165 value="{% trans %}UnBan User{% endtrans %}" />
166 {% endif %}
167 </form>
168 <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege',
169 user=user.username) }}"
170 method=post >
171 <table class="admin_side_panel">
172 <tr>
173 <th>{% trans %}Privilege{% endtrans %}</th>
174 <th>{% trans %}User Has Privilege{% endtrans %}</th>
175 </tr>
176 {% for privilege in privileges %}
177 <tr>
178 <td>{{ privilege.privilege_name }}</td>
179 {% if privilege in user.all_privileges %}
180 <td class="user_with_privilege">
181 {% trans %}Yes{% endtrans %}{% else %}
182 <td class="user_without_privilege">
183 {% trans %}No{% endtrans %}{% endif %}
184 </td>
185 {% if request.user.has_privilege('admin') %}
186 <td>
187 {% if privilege in user.all_privileges %}
188 <input type=submit id="{{ privilege.privilege_name }}"
189 class="submit_button button_action"
190 value =" -" />
191 {% else %}
192 <input type=submit id="{{ privilege.privilege_name }}"
193 class="submit_button button_action"
194 value ="+" />
195 {% endif %}
196 </td>
197 {% endif %}
198 </tr>
199 {% endfor %}
200 </table>
201 {{ csrf_token }}
202 <input type=hidden name=privilege_name id=hidden_privilege_name />
203 </form>
204 {% endif %}
205 <script>
206 $(document).ready(function(){
207 $('.submit_button').click(function(){
208 $('#hidden_privilege_name').val($(this).attr('id'));
209 });
210 init_user_banned_form();
211 $('#ban_user_submit').click(function(){
212 submit_user_banned_form()
213 });
214 });
215 </script>
216 {% endblock %}