This is a very small commit. All that I have done here is to clean up my code
[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
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
32 {% block mediagoblin_content -%}
33 {# If no user... #}
34 {% if not user %}
35 <p>{% trans %}Sorry, no such user found.{% endtrans %}</p>
36
37 {# User exists, but needs verification #}
38 {% elif user.status == "needs_email_verification" %}
39 <div class="form_box">
40 <h1>{% trans %}Email verification needed{% endtrans %}</h1>
41
42 <p>
43 {% trans -%}
44 Someone has registered an account with this username, but it still has
45 to be activated.
46 {%- endtrans %}
47 </p>
48
49 <p>
50 {% trans login_url=request.urlgen('mediagoblin.auth.login') -%}
51 If you are that person but you've lost your verification email, you can
52 <a href="{{ login_url }}">log in</a> and resend it.
53 {%- endtrans %}
54 </p>
55 </div>
56
57 {# Active(?) (or at least verified at some point) user, horray! #}
58 {% else %}
59 <h1>
60 {%- trans username=user.username %}{{ username }}'s profile{% endtrans -%}
61 {% if user_banned and user_banned.expiration_date %}
62 &mdash; BANNED until {{ user_banned.expiration_date }}
63 {% elif user_banned %}
64 &mdash; Banned Indefinitely
65 {% endif %}
66 </h1>
67
68 {% if not user.url and not user.bio %}
69 <div class="profile_sidebar empty_space">
70 <p>
71 {% trans -%}
72 This user hasn't filled in their profile (yet).
73 {%- endtrans %}
74 </p>
75 {% else %}
76 <div class="profile_sidebar">
77 {% include "mediagoblin/utils/profile.html" %}
78 {% if request.user and
79 (request.user.id == user.id or request.user.is_admin) %}
80 <a href="{{ request.urlgen('mediagoblin.edit.profile',
81 user=user.username) }}">
82 {%- trans %}Edit profile{% endtrans -%}
83 </a>
84 {% endif %}
85 {% endif %}
86 <p>
87 <a href="{{ request.urlgen('mediagoblin.user_pages.collection_list',
88 user=user.username) }}">
89 {%- trans %}Browse collections{% endtrans -%}
90 </a>
91 </p>
92 </div>
93 {% endif %}
94 {% if user %}
95 <h2>{%- trans %}Active Reports on {% endtrans -%}{{ user.username }}</h2>
96 {% if reports.count() %}
97 <table class="admin_side_panel">
98 <tr>
99 <th>{%- trans %}Report ID{% endtrans -%}</th>
100 <th>{%- trans %}Reported Content{% endtrans -%}</th>
101 <th>{%- trans %}Description of Report{% endtrans -%}</th>
102 </tr>
103 {% for report in reports %}
104 <tr>
105 <td>
106 <img src="{{ request.staticdirect('/images/icon_clipboard.png') }}" />
107 <a href="{{ request.urlgen('mediagoblin.moderation.reports_detail',
108 report_id=report.id) }}">
109 {%- trans %}Report #{% endtrans -%}{{ report.id }}
110 </a>
111 </td>
112 <td>
113 {% if report.discriminator == "comment_report" %}
114 <a>{%- trans %}Reported Comment{% endtrans -%}</a>
115 {% elif report.discriminator == "media_report" %}
116 <a>{%- trans %}Reported Media Entry{% endtrans -%}</a>
117 {% endif %}
118 </td>
119 <td>{{ report.report_content[:21] }}{% if report.report_content|count >20 %}...{% endif %}</td>
120 <td>{%- trans %}Resolve{% endtrans -%}</td>
121 </tr>
122 {% endfor %}
123 <tr><td></td><td></td>
124 </table>
125 {% else %}
126 {%- trans %}No active reports filed on {% endtrans -%} {{ user.username }}
127 {% endif %}
128 <a class="right_align">{{ user.username }}'s report history</a>
129 <span class=clear></span>
130 <h2>{{ user.username }}'s Privileges</h2>
131 <form action="{{ request.urlgen('mediagoblin.moderation.give_or_take_away_privilege',
132 user=user.username) }}"
133 method=post >
134 <table class="admin_side_panel">
135 <tr>
136 <th>{% trans %}Privilege{% endtrans %}</th>
137 <th>{% trans %}User Has Privilege{% endtrans %}</th>
138 </tr>
139 {% for privilege in privileges %}
140 <tr>
141 <td>{{ privilege.privilege_name }}</td>
142 {% if privilege in user.all_privileges %}
143 <td class="user_with_privilege">
144 Yes{% else %}
145 <td class="user_without_privilege">
146 No{% endif %}
147 </td>
148 {% if requesting_user_privileges.admin%}
149 <td>{% if privilege in user.all_privileges %}
150 <input type=submit id="{{ privilege.privilege_name }}" class=submit_button value ="-" />{% else %}
151 <input type=submit id="{{ privilege.privilege_name }}" class=submit_button value ="+" />{% endif %}
152 </td>
153 {% endif %}
154
155 </tr>
156 {% endfor %}
157 </table>
158 {{ csrf_token }}
159 <input type=hidden name=privilege_name id=hidden_privilege_name />
160 </form>
161 {% endif %}
162 <script>
163 $(document).ready(function(){
164 $('.submit_button').click(function(){
165 $('#hidden_privilege_name').val($(this).attr('id'));
166 });
167 });
168 </script>
169 {% endblock %}