-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathindex.html
More file actions
385 lines (368 loc) · 16 KB
/
index.html
File metadata and controls
385 lines (368 loc) · 16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
{% extends "saas/base_dashboard.html" %}
<!-- Dashboard User Profile Page -->
{% block saas_title %}
{% trans %}Profile{% endtrans %}
{% endblock %}
{% block saas_page_layout %}
<{% if urls.user %}user{% else %}profile{% endif %}-update inline-template id="profile-container">
<div>
<div class="row">
<div class="col-md-6">
{# We use the hidden input to pass the picture URL to the Vue component. #}
<input name="picture" value="{% if form.instance.picture %}{{form.instance.picture}}{% else %}{% if organization and not (urls.user and urls.user.password_change) %}{{'/assets/img/default-organization.png'}}{% else %}{{'/assets/img/default-user.png'}}{% endif %}{% endif %}" type="hidden">
<img class="img-thumbnail{% if urls.user %} rounded-circle{% endif %}"
:src="formFields.picture" width="100" height="100"
data-bs-toggle="modal" data-bs-target="#upload-picture-modal">
</div>
<div class="col-md-6">
{% block saas_help %}
{% trans %}Update your contact information, password, etc.{% endtrans %}
{% endblock %}
</div>
</div>
<div class="row pb-3">
<div class="col-md-6">
{% include "saas/profile/_form.html" %}
</div>
<div class="col-md-6">
{% if organization %}
{% trans created_at=organization.created_at|humanize_short_date %}Created at {{created_at}}{% endtrans %}
{% elif user %}
{% trans created_at=user.date_joined|humanize_short_date %}Created at {{created_at}}{% endtrans %}
{% endif %}
<hr />
{% if urls.api_activities %}
<div class="mt-4 p-2 bg-warning-subtle">
{% include "saas/profile/_provider_form.html" %}
<hr />
<contact-update inline-template>
<div>
<h3>{% trans %}Activities{% endtrans %}</h3>
<form class="form" @submit.prevent="createActivity">
<input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">
<div class="form-group mb-3">
<label class="form-label">{% if organization %}{% trans %}Contact{% endtrans %}{% else %}{% trans %}Profile{% endtrans %}{% endif %}</label>
<account-typeahead inline-template ref="contact"
v-bind:dataset="items.results"
v-on:selectitem="updateItemSelected">
<div>
<div class="input-group mb-3">
<!-- optional indicators -->
<span class="input-group-text">
<i class="fa fa-spinner fa-spin" v-if="loading"></i>
<template v-else>
<i class="fa fa-search" v-show="isEmpty"></i>
<i class="fa fa-times" v-show="isDirty" @click="reset"></i>
</template>
</span>
<!-- the input field -->
<input class="form-control"
type="text"
name="user"
placeholder="{% trans %}Username or e-mail{% endtrans %}"
autocomplete="off"
v-model="query"
@keydown.down="down"
@keydown.up="up"
@keydown.enter.prevent="hit"
@blur="clear"
@input="update" />
<!-- the list -->
{# Implementation note: If we use `d-block` instead of #}
{# `style="display: block;"` the dropdown shows even #}
{# when `hasItems` is `False`. #}
<ul class="dropdown-menu nav-pills p-1 top-100"
style="display: block;"
v-show="hasItems">
<li v-for="(item, $item) in items" class="nav-item"
@mousedown="hit"
@mousemove="setActive($item)">
<a :class="'nav-link px-3 py-2' + activeClass($item)" v-text="item.printable_name"></a>
</li>
</ul>
</div>
</div>
</account-typeahead>
</div>
<div class="form-group mb-3">
<label class="form-label">{% trans %}Description{% endtrans %}</label>
<textarea class="form-control" rows="10"
name="text"
v-model="activityText"></textarea>
</div>
<div class="text-end">
<button class="btn btn-primary"
type="submit"value="submit">{% trans %}Create activity{% endtrans %}</button>
</div>
</form>
<div v-show="!itemsLoaded">
<h4 class="text-center"><i class="fa fa-refresh fa-spin"></i></h4>
</div>
<div id="has-no-activity" v-show="itemsLoaded && items.results.length === 0" v-cloak>
<h4><em>{% trans %}No activity{% endtrans %}<span> [[params.q]]</span></em></h4>
</div>
<div id="has-activities" v-show="itemsLoaded && items.results.length > 0" v-cloak>
<div v-for="entry in items.results">
<p>[[$globals.humanizeDate(entry.created_at)]]
<span v-if="entry.created_by">
{% trans %}by{% endtrans %} <a :href="'{{request|site_url}}/users/' + entry.created_by.username + '/'">[[entry.created_by.printable_name]]</a></span>:
</p>
<p v-if="entry.contact">
{% trans %}Contact{% endtrans %}: <a :href="'{{request|site_url}}/users/' + entry.contact.username + '/'">[[entry.contact.printable_name]]</a>
</p>
<div>[[entry.text]]</div>
</div>
</div>
</div>
</contact-update>
</div>
{% endif %}
</div>
</div>
<!-- End Form Inputs -->
<div class="row">
<div class="col-md-12">
<hr class="my-0" />
</div>
</div>
<div class="row">
{% if urls.user %}
<div class="col-md-6 mt-4">
<div class="card border-secondary">
<div class="card-body text-secondary">
{# Update Password #}
{% if urls.user.password_change %}
<div class="row align-items-center mb-3">
<div class="col-md-12">
<a id="change-password" class="mb-2" href="{{urls.user.password_change}}">{% trans %}Change Password{% endtrans %}</a>
</div>
<div class="col-md-12">
{% trans %}Use a new password to login.{% endtrans %}
</div>
</div>
{% endif %}
{# Update Keys #}
{% if urls.user.keys_update %}
<div class="row align-items-center mb-3">
<div class="col-md-12">
<a id="keys-update" class="mb-2" href="{{urls.user.keys_update}}">{% trans %}Programmatic Keys{% endtrans %}</a>
</div>
<div class="col-md-12">
{% trans %}Obtain new API Keys to authenticate.{% endtrans %}
</div>
</div>
{% endif %}
{% if urls.user.api_activate %}
<div class="row align-items-center">
<div class="col-sm-5">
<div class="d-grid gap-2">
<button id="activate-user" class="btn btn-primary" @click="activate">{% trans %}Activate{% endtrans %}</button>
</div>
</div>
<div class="col-sm-7">
{% trans %}Send an activation e-mail to the user.{% endtrans %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
<!-- Danger Zone -->
<div class="col-md-6 mt-4">
<div class="card border-danger h-100">
<div class="card-header">
{% trans %}Danger Zone{% endtrans %}
</div>
<div class="card-body text-danger">
<div class="row align-items-center">
<div class="col-md-12">
<div class="d-grid gap-2">
<button id="delete-action-open"
class="btn btn-danger mb-3"
data-bs-toggle="modal"
data-bs-target="#delete-action">{% trans %}Delete{% endtrans %}</button>
</div>
</div>
<div class="col-md-12">
{% trans %}This operation cannot be reversed.{% endtrans %}
</div>
</div>
</div>
</div>
</div>
</div>
<!-- *** -->
<!-- Start Modal Dialogs -->
<!-- *** -->
<!-- Modal dialog to upload a picture -->
<div id="upload-picture-modal"
class="upload-picture modal fade"
title="{% trans %}Upload picture ...{% endtrans %}"
tabindex="-1" role="dialog"
aria-labelledby="{% trans %}Upload picture ...{% endtrans %}"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{% trans %}Upload picture ...{% endtrans %}</h4>
<button type="button" class="btn-close"
data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<div class="text-center border">
<croppa v-model="picture"{% if urls.user %} v-init-croppa{% endif %} v-zoom-slider
:width="300"
:height="300"
:prevent-white-space="true"
:show-remove-button="false"
></croppa>
</div>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-outline-primary"
data-bs-dismiss="modal">
{% trans %}Cancel{% endtrans %}</button>
<button type="submit" class="btn btn-primary" data-bs-dismiss="modal" @click="uploadProfilePicture">{% trans %}Save picture{% endtrans %}</button>
</div>
</div>
</div>
</div>
<!-- modal dialog to delete organization. -->
<div class="modal fade"
id="delete-action" tabindex="-1" role="dialog"
aria-labelledby="{% trans %}Delete Profile{% endtrans %}" aria-hidden="true">
<form class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans %}Delete Profile{% endtrans %} ...</h5>
<button type="button" class="btn-close"
data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body">
<p>
{% if organization %}
{% trans profile_name=organization.printable_name %}You are about to delete the profile and account for {{profile_name}}.{% endtrans %}
{% elif user %}
{% trans profile_name=user.full_name %}You are about to delete the profile and account for {{profile_name}}.{% endtrans %}
{% endif %}
{% trans %}This operation cannot be reversed.{% endtrans %}
</p>
<p>
{% trans %}Are you sure you want to continue?{% endtrans %}
</p>
</div>
<div class="modal-footer">
<button data-bs-dismiss="modal"
class="btn btn-outline-primary">{% trans %}Cancel{% endtrans %}</button>
<button type="button" id="delete-organization-btn"
class="btn btn-danger"
data-bs-dismiss="modal"
@click="deleteProfile">{% trans %}Delete{% endtrans %}</button>
</div>
</div>
</form>
</div><!-- end modal to delete profile -->
<!-- modal dialog to verifiy email -->
<div class="modal fade"
id="verify-email" tabindex="-1" role="dialog"
aria-labelledby="{% trans %}Verify e-mail{% endtrans %}"
aria-hidden="true">
<form class="modal-dialog" method="POST" @submit.prevent="updateProfile">
<input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans %}Verify e-mail{% endtrans %} ...</h5>
<button type="button" class="btn-close"
data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body" v-show="!codeSent">
<p>
{% trans %}We will send an e-mail with a one-time verification link. Please click, or copy/paste the link in a browser window, to verify the e-mail address.{% endtrans %}
</p>
<p>
{% trans %}Are you ready to verify the email address?{% endtrans %}
</p>
</div>
<div class="modal-body" v-show="codeSent">
<p>
{% trans %}We sent a code to your e-mail address.{% endtrans %}
</p>
<label class="form-label">{% trans %}Verification Code{% endtrans %}</label>
<input class="form-control" type="text" name="email_code" v-model="emailCode"></input>
</div>
<div class="modal-footer">
<button data-bs-dismiss="modal"
class="btn btn-outline-primary">{% trans %}Cancel{% endtrans %}</button>
<button type="button" id="verify-email-btn"
class="btn btn-primary"
@click.prevent="verifyEmail" v-if="!codeSent">{% trans %}Email link{% endtrans %}</button>
<button type="submit" id="verify-email-code"
class="btn btn-primary"
data-bs-dismiss="modal"
v-if="codeSent">{% trans %}Verify{% endtrans %}</button>
</div>
</div>
</form>
</div><!-- /#verify-email -->
<!-- modal dialog to verifiy phone -->
<div class="modal fade"
id="verify-phone" tabindex="-1" role="dialog"
aria-labelledby="{% trans %}Verify phone{% endtrans %}"
aria-hidden="true">
<form class="modal-dialog" method="POST" @submit.prevent="updateProfile">
<input type="hidden" name="csrfmiddlewaretoken" value="{{csrf_token}}">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans %}Verify phone number{% endtrans %} ...</h5>
<button type="button" class="btn-close"
data-bs-dismiss="modal" aria-hidden="true"></button>
</div>
<div class="modal-body" v-if="!codeSent">
<p>
{% trans %}We will text a one-time code to the phone number. We will then ask you to enter this code to verify the phone number.{% endtrans %}
</p>
<p>
{% trans %}Are you ready to verify the phone number?{% endtrans %}
</p>
</div>
<div class="modal-body" v-if="codeSent">
<label class="form-label">{% trans %}Verification Code{% endtrans %}</label>
<input class="form-control" type="text" name="phone_code" v-model="phoneCode"></input>
</div>
<div class="modal-footer">
<button data-bs-dismiss="modal"
class="btn btn-outline-primary">{% trans %}Cancel{% endtrans %}</button>
<button type="button" id="verify-phone-btn"
class="btn btn-primary"
@click.prevent="verifyPhone" v-if="!codeSent">{% trans %}Text a code{% endtrans %}</button>
<button type="submit" id="verify-phone-code"
class="btn btn-primary"
data-bs-dismiss="modal"
v-if="codeSent">{% trans %}Verify{% endtrans %}</button>
</div>
</div>
</form>
</div><!-- /#verify-phone -->
</div>
</{% if urls.user %}user{% else %}profile{% endif %}-update>
{% endblock %}
{% block dashboard_bodyscripts %}
{% if urls.user %}
<script type="text/javascript">
Vue.directive('init-croppa', {
inserted: function(el) {
var croppaInstance = el.__vue__;
if (croppaInstance && typeof croppaInstance.addClipPlugin === 'function') {
croppaInstance.addClipPlugin(function(ctx, x, y, w, h) {
ctx.beginPath();
ctx.arc(x + w / 2, y + h / 2, w / 2, 0, 2 * Math.PI, true);
ctx.closePath();
});
}
}
});
</script>
{% endif %}
{% endblock %}