forked from fedora-infra/noggin
/
user-settings-profile.html
95 lines (92 loc) · 3.71 KB
/
user-settings-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
{% extends "user-settings.html" %}
{% import '_form_macros.html' as macros %}
{% block head %}
{{ super() }}
{{ macros.selectize_css() }}
{% endblock %}
{% block settings_content %}
<div class="card-body border-bottom">
<img src="{{ gravatar(user.mail if user.mail else 'default', 100) }}" class="pb-2" alt="user avatar"/>
{% set buttontext = _('Change Avatar')%}
{%- if OPENID is defined %}
<form method="GET" action="https://www.libravatar.org/openid/login/">
<input type="hidden" name="openid_identifier" value="{{ OPENID % (user.username) }}">
<input name="change-avatar" type="submit" value="{{ buttontext }}" class="btn btn-sm btn-outline-primary">
</form>
{%- else %}
<a href="https://www.libravatar.org/accounts/login/" class="btn btn-sm btn-outline-primary">{{ buttontext }}</a>
{%- endif %}
</div>
<form class="needs-validation" action="{{ url_for('.user_settings_profile', username=user.username) }}" method="post" novalidate>
{{ form.csrf_token }}
<div class="card-body">
<div class="form-row">
<div class="form-group col">{{ macros.with_errors(form.firstname) }}</div>
<div class="form-group col">{{ macros.with_errors(form.lastname) }}</div>
</div>
<div class="form-group">{{ macros.with_errors(form.pronouns) }}</div>
<div class="form-group">{{ macros.with_errors(form.locale, class="custom-select") }}</div>
<div class="form-group">{{ macros.with_errors(form.timezone, class="custom-select") }}</div>
<div class="form-group">{{ macros.with_errors(form.website_url) }}</div>
<div class="form-group">{{ macros.with_errors(form.rss_url) }}</div>
<div class="form-group mb-4">
<p class="m-0">{{ form.ircnick.label(class_="mt-2") }}</p>
<p class="m-0">
{% trans %}
The format is either <code>username</code> or <code>username:server.name</code> if you're not using the default servers:
{% endtrans %}
</p>
<ul class="mb-2">
{% for name, title in form.ircnick.entries[0].subfields[0].choices %}
<li>
{% trans server=config["CHAT_NETWORKS"][name]["default_server"] %}
For {{title}}: <code>{{server}}</code>
{% endtrans %}
</li>
{% endfor %}
</ul>
{{ macros.with_errors(form.ircnick, label=False) }}
</div>
<div class="form-group">{{ macros.with_errors(form.github) }}</div>
<div class="form-group">{{ macros.with_errors(form.gitlab) }}</div>
<div class="form-group form-check">{{ macros.with_errors(form.is_private) }}</div>
</div>
<div class="card-footer d-flex justify-content-between">
<div>{{ macros.non_field_errors(form) }}</div>
<button class="btn btn-primary" id="submit" type="submit">{{_("Save")}}</button>
</div>
</form>
{% endblock %}
{% block scripts %}
{{ super () }}
{{ macros.unsaved_changes() }}
{{ macros.selectize() }}
<script nonce="{{ csp_nonce() }}">
// Clear buttons
$('.input-group button[data-action="clear"]').click(function() {
$(this).parents(".input-group").first().find("input[type='text']").val("");
})
// Pronouns
$('#pronouns').selectize({
delimiter: ',',
options: [
{value:"she / her / hers", text:"she / her / hers"},
{value:"he / him / his", text:"he / him / his"},
{value:"they / them / theirs", text:"they / them / theirs"},
],
persist: false,
create: function(input) {
return {
value: input,
text: input
}
}
});
$('#locale').selectize({
sortField : [{field: 'value', direction: 'asc'}],
});
$('#timezone').selectize({
sortField : [{field: 'value', direction: 'asc'}],
});
</script>
{% endblock %}