]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/users/profile.html
d2f5baa254ba720c34e44ece98df0d8cc5ce994f
[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                                                                 {% if user == current_user %}
68                                                                         <br>
69                                                                         <small class="text-muted">
70                                                                                 <span style="padding-right: 5px;">&#x1f30e;</span>
71                                                                                 Visible to everyone
72                                                                         </small>
73                                                                 {% endif %}
74                                                         </td>
75                                                 </tr>
76                                                 {% if current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.MODERATOR) %}
77                                                 <tr>
78                                                         <td>Admin</td>
79                                                         <td>
80                                                                 {% if user.email %}
81                                                                         <a class="btn btn-primary" href="{{ url_for('users.send_email', username=user.username) }}">
82                                                                                 Email
83                                                                         </a>
84                                                                 {% else %}
85                                                                         <a class="btn btn-primary disabled"
86                                                                                         data-toggle="tooltip" data-placement="bottom"
87                                                                                         title="No email address for user"
88                                                                                         style="pointer-events: all;">
89                                                                                 Email
90                                                                         </a>
91                                                                 {% endif %}
92                                                         </td>
93                                                 </tr>
94                                                 {% endif %}
95                                                 {% if user == current_user %}
96                                                         <tr>
97                                                                 <td>Profile Picture:</td>
98                                                                 <td>
99                                                                         {% if user.forums_username %}
100                                                                                 <form method="post" action="{{ url_for('users.user_check', username=user.username) }}" class="" style="display:inline-block;">
101                                                                                         <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
102                                                                                         <input type="submit" class="btn btn-primary" value="Sync with Forums" />
103                                                                                 </form>
104                                                                         {% endif %}
105                                                                         {% if user.email %}
106                                                                                 <a class="btn btn-primary" href="https://en.gravatar.com/">
107                                                                                         Gravatar
108                                                                                 </a>
109                                                                         {% else %}
110                                                                                 <a class="btn btn-primary disabled"
111                                                                                                 data-toggle="tooltip" data-placement="bottom"
112                                                                                                 title="Please add an email address to use Gravatar"
113                                                                                                 style="pointer-events: all;">
114                                                                                         Gravatar
115                                                                                 </a>
116                                                                         {% endif %}
117                                                                 </td>
118                                                         </tr>
119                                                         <tr>
120                                                                 <td>Password:</td>
121                                                                 <td>
122                                                                         {% if user.password %}
123                                                                                 Set | <a href="{{ url_for('user.change_password') }}">Change</a>
124                                                                         {% else %}
125                                                                                 Not set | <a href="{{ url_for('users.set_password') }}">Set</a>
126                                                                         {% endif %}
127                                                                 </td>
128                                                         </tr>
129                                                 {% endif %}
130                                                 {% if user.checkPerm(current_user, "CREATE_TOKEN") %}
131                                                 <tr>
132                                                         <td>API Tokens:</td>
133                                                         <td>
134                                                                 <a href="{{ url_for('api.list_tokens', username=user.username) }}">Manage</a>
135                                                                 <span class="badge badge-primary">{{ user.tokens.count() }}</span>
136                                                         </td>
137                                                 </tr>
138                                                 {% endif %}
139                                         </table>
140                                 </div>
141                         </div>
142                 </div>
143         </div>
144
145 {% if form %}
146         {% from "macros/forms.html" import render_field, render_submit_field %}
147         <div class="col-sm-6">
148                 <div class="card">
149                         <div class="card-header">Edit Details</div>
150                         <div class="card-body">
151                                 <form action="" method="POST" class="form box-body" role="form">
152                                         {{ form.hidden_tag() }}
153
154                                         {% if user.checkPerm(current_user, "CHANGE_DNAME") %}
155                                                 {{ render_field(form.display_name, tabindex=230) }}
156                                                 {{ render_field(form.website_url, tabindex=232) }}
157                                                 {{ render_field(form.donate_url, tabindex=233) }}
158                                         {% endif %}
159
160                                         {% if user.checkPerm(current_user, "CHANGE_EMAIL") %}
161                                                 {{ render_field(form.email, tabindex=240) }}
162                                                 <i>We'll send you an email to verify it if changed.</i>
163                                         {% endif %}
164
165                                         {% if user.checkPerm(current_user, "CHANGE_RANK") %}
166                                                 {{ render_field(form.rank, tabindex=250) }}
167                                         {% endif %}
168
169                                         {{ render_submit_field(form.submit, tabindex=280) }}
170                                 </form>
171                         </div>
172                 </div>
173         </div>
174 {% endif %}
175 </div>
176
177 {% from "macros/packagegridtile.html" import render_pkggrid %}
178 {{ render_pkggrid(packages, show_author=False) }}
179
180 {% if user.donate_url %}
181         <div class="alert alert-secondary">
182                 Like {{ user.display_name }}'s work?
183                 <a href="{{ user.donate_url }}" rel="nofollow">Donate now!</a>
184         </div>
185 {% endif %}
186
187 {% if current_user == user or (current_user.is_authenticated and current_user.rank.atLeast(current_user.rank.EDITOR)) %}
188         <div class="card mt-3">
189                 <a name="unadded-topics"></a>
190                 <h2 class="card-header">Unadded topics</h2>
191
192                 {% if topics_to_add %}
193                         <p class="card-body">
194                                 List of your forum topics which do not have a matching package.
195                                 Topics with a strikethrough have been marked as discarded.
196                         </p>
197
198                         {% from "macros/topics.html" import render_topics_table %}
199                         {{ render_topics_table(topics_to_add, show_author=False, show_discard=True, current_user=current_user) }}
200                 {% else %}
201                         <p class="card-body">Congrats! You don't have any topics which aren't on CDB.</p>
202                 {% endif %}
203         </div>
204 {% endif %}
205
206 {% endblock %}
207
208
209 {% block scriptextra %}
210         <script>
211                 var csrf_token = "{{ csrf_token() }}";
212         </script>
213         <script src="/static/topic_discard.js"></script>
214 {% endblock %}