]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/users/profile.html
Improve tags page layout and add link to profile
[cheatdb.git] / app / templates / users / profile.html
1 {% extends "base.html" %}
2
3 {% block title %}
4         {{ user.username }}
5 {% endblock %}
6
7 {% block content %}
8
9 {% if not current_user.is_authenticated and user.rank == user.rank.NOT_JOINED and user.forums_username %}
10 <div class="alert alert-info">
11         <a class="float-right btn btn-default btn-sm"
12                 href="{{ url_for('users.claim', username=user.forums_username) }}">Claim</a>
13
14         Is this you? Claim your account now!
15 </div>
16 {% endif %}
17
18 <div class="row mb-3">
19
20         <div class="col-sm-6">
21                 <div class="card">
22                         <h2 class="card-header">{{ user.display_name }}</h2>
23                         <div class="card-body row">
24                                 <div class="col-md-2">
25                                         {% if user.forums_username %}
26                                                 <a href="https://forum.minetest.net/ucp.php?i=profile&mode=avatar">
27                                         {% elif user.email %}
28                                                 <a href="https://en.gravatar.com/">
29                                         {% endif %}
30                                         <img class="img-responsive user-photo img-thumbnail  img-thumbnail-1" src="{{ user.getProfilePicURL() }}">
31                                         {% if user.forums_username or user.email %}
32                                                 </a>
33                                         {% endif %}
34                                 </div>
35                                 <div class="col">
36                                         <table class="table">
37                                                 <tr>
38                                                         <td>Rank:</td>
39                                                         <td>
40                                                                 {{ user.rank.getTitle() }}
41                                                         </td>
42                                                 </tr>
43                                                 <tr>
44                                                         <td>Links:</td>
45                                                         <td>
46                                                                 {% if user.forums_username %}
47                                                                         <a href="https://forum.minetest.net/memberlist.php?mode=viewprofile&un={{ user.forums_username }}">
48                                                                                 Minetest Forum
49                                                                         </a>
50                                                                 {% elif user == current_user %}
51                                                                         No forum account
52                                                                 {% endif %}
53
54                                                                 {% if user.github_username or user == current_user %}
55                                                                         |
56                                                                 {% endif %}
57
58                                                                 {% if user.github_username %}
59                                                                         <a href="https://github.com/{{ user.github_username }}">GitHub</a>
60                                                                 {% elif user == current_user %}
61                                                                         <a href="{{ url_for('github.start') }}">Link Github</a>
62                                                                 {% endif %}
63
64                                                                 {% if user.website_url %}
65                                                                         | <a href="{{ user.website_url }}" rel="nofollow">Website</a>
66                                                                 {% endif %}
67
68
69                                                                 {% if user == current_user %}
70                                                                         <br>
71                                                                         <small class="text-muted">
72                                                                                 <span style="padding-right: 5px;">&#x1f30e;</span>
73                                                                                 Visible to everyone
74                                                                         </small>
75                                                                 {% endif %}
76                                                         </td>
77                                                 </tr>
78
79                                                 {% if user == current_user and user.github_username %}
80                                                         <tr>
81                                                                 <td>Privacy:</td>
82                                                                 <td>
83                                                                         <a href="{{ url_for('github.view_permissions') }}">View ContentDB's GitHub Permissions</a>
84                                                                 </td>
85                                                         </tr>
86                                                 {% endif %}
87
88                                                 {% if current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.MODERATOR) %}
89                                                 <tr>
90                                                         <td>Admin</td>
91                                                         <td>
92                                                                 {% if user.email %}
93                                                                         <a class="btn btn-primary" href="{{ url_for('users.send_email', username=user.username) }}">
94                                                                                 Email
95                                                                         </a>
96                                                                 {% else %}
97                                                                         <a class="btn btn-primary disabled"
98                                                                                         data-toggle="tooltip" data-placement="bottom"
99                                                                                         title="No email address for user"
100                                                                                         style="pointer-events: all;">
101                                                                                 Email
102                                                                         </a>
103                                                                 {% endif %}
104                                                         </td>
105                                                 </tr>
106                                                 {% endif %}
107                                                 {% if user == current_user %}
108                                                         <tr>
109                                                                 <td>Profile Picture:</td>
110                                                                 <td>
111                                                                         {% if user.forums_username %}
112                                                                                 <form method="post" action="{{ url_for('users.user_check', username=user.username) }}" class="" style="display:inline-block;">
113                                                                                         <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
114                                                                                         <input type="submit" class="btn btn-primary" value="Sync with Forums" />
115                                                                                 </form>
116                                                                         {% endif %}
117                                                                         {% if user.email %}
118                                                                                 <a class="btn btn-primary" href="https://en.gravatar.com/">
119                                                                                         Gravatar
120                                                                                 </a>
121                                                                         {% else %}
122                                                                                 <a class="btn btn-primary disabled"
123                                                                                                 data-toggle="tooltip" data-placement="bottom"
124                                                                                                 title="Please add an email address to use Gravatar"
125                                                                                                 style="pointer-events: all;">
126                                                                                         Gravatar
127                                                                                 </a>
128                                                                         {% endif %}
129                                                                 </td>
130                                                 </tr>
131                                                         <tr>
132                                                                 <td>Password:</td>
133                                                                 <td>
134                                                                         {% if user.password %}
135                                                                                 Set | <a href="{{ url_for('user.change_password') }}">Change</a>
136                                                                         {% else %}
137                                                                                 Not set | <a href="{{ url_for('users.set_password') }}">Set</a>
138                                                                         {% endif %}
139                                                                 </td>
140                                                         </tr>
141                                                 {% endif %}
142                                                 {% if user.checkPerm(current_user, "CREATE_TOKEN") %}
143                                                 <tr>
144                                                         <td>API Tokens:</td>
145                                                         <td>
146                                                                 <a href="{{ url_for('api.list_tokens', username=user.username) }}">Manage</a>
147                                                                 <span class="badge badge-primary">{{ user.tokens.count() }}</span>
148                                                         </td>
149                                                 </tr>
150                                                 {% endif %}
151                                         </table>
152                                 </div>
153                         </div>
154                 </div>
155         </div>
156
157 {% if form %}
158         {% from "macros/forms.html" import render_field, render_submit_field %}
159         <div class="col-sm-6">
160                 <div class="card">
161                         <div class="card-header">Edit Details</div>
162                         <div class="card-body">
163                                 <form action="" method="POST" class="form box-body" role="form">
164                                         {{ form.hidden_tag() }}
165
166                                         {% if user.checkPerm(current_user, "CHANGE_USERNAMES") %}
167                                                 {{ render_field(form.display_name, tabindex=230) }}
168                                                 {{ render_field(form.forums_username, tabindex=230) }}
169                                                 {{ render_field(form.github_username, tabindex=230) }}
170                                         {% endif %}
171
172                                         {% if user.checkPerm(current_user, "CHANGE_PROFILE_URLS") %}
173                                                 {{ render_field(form.website_url, tabindex=232) }}
174                                                 {{ render_field(form.donate_url, tabindex=233) }}
175                                         {% endif %}
176
177                                         {% if user.checkPerm(current_user, "CHANGE_EMAIL") %}
178                                                 {{ render_field(form.email, tabindex=240) }}
179                                                 <i>We'll send you an email to verify it if changed.</i>
180                                         {% endif %}
181
182                                         {% if user.checkPerm(current_user, "CHANGE_RANK") %}
183                                                 {{ render_field(form.rank, tabindex=250) }}
184                                         {% endif %}
185
186                                         <p>
187                                                 {{ render_submit_field(form.submit, tabindex=280) }}
188                                         </p>
189                                 </form>
190                         </div>
191                 </div>
192         </div>
193 {% endif %}
194 </div>
195
196 {% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.EDITOR)) %}
197 <a class="float-right btn btn-sm btn-primary"
198                 href="{{ url_for('todo.tags', author=user.username) }}">
199         View list of tags
200 </a>
201 {% endif %}
202
203 <h2 class="my-3">{{ _("Packages") }}</h2>
204
205 {% from "macros/packagegridtile.html" import render_pkggrid %}
206 {{ render_pkggrid(packages, show_author=False) }}
207
208 {% if user.donate_url %}
209         <div class="alert alert-secondary">
210                 Like {{ user.display_name }}'s work?
211                 <a href="{{ user.donate_url }}" rel="nofollow">Donate now!</a>
212         </div>
213 {% endif %}
214
215
216 <h2 class="my-3">{{ _("Reviews") }}</h2>
217 {% from "macros/reviews.html" import render_reviews %}
218 {{ render_reviews(user.reviews, current_user, True) }}
219
220
221 {% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.EDITOR)) %}
222         <div class="card mt-5">
223                 <a name="unadded-topics"></a>
224                 <h2 class="card-header">Unadded topics</h2>
225
226                 {% if topics_to_add %}
227                         <p class="card-body">
228                                 List of your forum topics which do not have a matching package.
229                                 Topics with a strikethrough have been marked as discarded.
230                         </p>
231
232                         {% from "macros/topics.html" import render_topics_table %}
233                         {{ render_topics_table(topics_to_add, show_author=False, show_discard=True, current_user=current_user) }}
234                 {% else %}
235                         <p class="card-body">Congrats! You don't have any topics which aren't on CDB.</p>
236                 {% endif %}
237         </div>
238 {% endif %}
239
240 {% endblock %}
241
242
243 {% block scriptextra %}
244         <script>
245                 var csrf_token = "{{ csrf_token() }}";
246         </script>
247         <script src="/static/topic_discard.js"></script>
248 {% endblock %}