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