-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathprofile.html
121 lines (111 loc) · 6.25 KB
/
profile.html
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
{% extends "core/base.html" %}
{% load widget_tweaks %}
{% load staticfiles %}
{% load i18n %}
{% block top-nav %}profile{% endblock %}
{% block title %} | {% trans "Edit profile" %}{% endblock %}
{% block extra_script %}
<script src="{% static 'js/parsleyAddValidator.js' %}"></script>
<script src="{% static 'libphonenumber-js/1.0.24/libphonenumber-js.min.js' %}"></script>
{{ form.media }}
{% endblock %}
{% block content %}
<form class="profile-form" method="POST" action="{% url 'account:profile' %}" data-parsley-validate>
{% csrf_token %}
<div class="panel panel-default form-narrow form-2col">
<div class="panel-body">
{{ form.non_field_errors }}
<h1>{% trans "Update your profile" %}</h1>
<div class="row">
<div class="col-md-8">
<!-- input profile fields -->
<div class="form-group{% if form.username.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.username.id_for_label }}">{% trans "Username" %}</label>
{% render_field form.username class+="form-control input-lg" data-parsley-required="true" data-parsley-sanitize="1" %}
<div class="error-block">{{ form.username.errors }}</div>
</div>
{% url 'account:resend_token' as resend_url %}
{% if form.instance.email %}
<div class="form-group{% if form.email.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.email.id_for_label }}">{% trans "Email" %}</label>
{% render_field form.email class+="form-control input-lg" data-parsley-sanitize="1" %}
{% if emails_to_verify %}
<p class="help-block small">{% blocktrans %} The email for this account has been changed recently, but the new email address has not yet been verified. You should have received an email with a link to verify the new email address. To manually verify the new email address, click <a href="{{ resend_url }}">here.</a>{% endblocktrans %}</p>
{% endif %}
<div class="error-block">{{ form.email.errors }}</div>
</div>
{% endif %}
{% if form.instance.phone %}
<div class="form-group{% if form.phone.errors %} has-error{%endif%}">
<label class="control-label" for="{{ form.phone.id_for_label }}">{% trans "Phone" %}</label>
{% render_field form.phone class+='form-control input-lg' data-parsley-validation-threshold="1" data-parsley-phonenumber="1" data-parsley-phoneplus="1" data-parsley-phonelength="1" data-parsley-errors-container="#phone-errors" %}
{% if phones_to_verify %}
<p class="help-block small">{% blocktrans %} The phone for this account has been changed recently, but the new phone number has not yet been verified. To verify the new phone number, click <a href="{{ resend_url }}"> here.</a>{% endblocktrans %}</p>
{% endif %}
<div id="phone-errors"></div>
<div class="error-block">{{ form.phone.errors }}</div>
</div>
{% endif %}
<div class="form-group{% if form.full_name.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.full_name.id_for_label }}">{% trans "Full name" %}</label>
{% render_field form.full_name class+="form-control input-lg" data-parsley-sanitize="1" %}
<div class="error-block">{{ form.full_name.errors }}</div>
</div>
<div class="form-group{% if form.language.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.language.id_for_label }}">{% trans "Your preferred language" %}</label>
{% render_field form.language class+="form-control input-lg" %}
<div class="error-block">{{ form.language.errors }}</div>
</div>
<div class="form-group{% if form.measurement.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.measurement.id_for_label }}">{% trans "Your preferred measurement system" %}</label>
{% render_field form.measurement class+="form-control input-lg" %}
<div class="error-block">{{ form.measurement.errors }}</div>
</div>
</div>
<div class="col-md-4">
<!-- input profile avatar -->
<div class="form-group{% if form.avatar.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.avatar.id_for_label }}">{% trans "Profile picture" %}</label>
<div class="well text-center">
<div id="preview-box" class="center-block">
<img src="{{ user.avatar_url }}" id="avatar-preview" />
</div>
<p class="help-block small">{% trans "For best results upload a square image, ideally 200x200 pixels." %}</p>
{% render_field form.avatar class+="form-control input-lg" data-parsley-sanitize="1" %}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="well form-group {% if form.password.errors %} has-error{% endif %}">
<label class="control-label" for="{{ form.password.id_for_label }}">{% trans "Password" %}</label>
<p class="help-block small">{% trans "Please enter your password to verify your identity." %}</p>
{% render_field form.password class+="form-control input-lg" data-parsley-required="true" data-parsley-sanitize="1" %}
<div class="error-block">{{ form.password.errors }}</div>
</div>
</div>
<div class="col-md-4">
<h5>{% trans "Password options" %}</h5>
<ul>
<li>
<a href="{% url 'account_change_password' %}">
{% trans "Change password" %}
</a>
</li>
<li>
<a href="{% url 'account_reset_password' %}">
{% trans "Reset password" %}
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="panel-footer panel-buttons text-center">
<button name="update" type="submit" class="btn btn-primary">{% trans "Save" %}</button>
<a href="{% url 'account:dashboard' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</div>
</div>
</form>
{% endblock %}