Added support for indicating the primary email address of one's datatracker account. Fixes issue #2106.
- Legacy-Id: 12841
This commit is contained in:
parent
bb5e5b97ba
commit
0f4207c997
|
@ -236,9 +236,13 @@ def profile(request):
|
||||||
r.email = e
|
r.email = e
|
||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
|
primary_email = request.POST.get("primary_email", None)
|
||||||
active_emails = request.POST.getlist("active_emails", [])
|
active_emails = request.POST.getlist("active_emails", [])
|
||||||
for email in emails:
|
for email in emails:
|
||||||
email.active = email.pk in active_emails
|
email.active = email.pk in active_emails
|
||||||
|
email.primary = email.address == primary_email
|
||||||
|
if email.primary and not email.active:
|
||||||
|
email.active = True
|
||||||
email.save()
|
email.save()
|
||||||
|
|
||||||
# Make sure the alias table contains any new and/or old names.
|
# Make sure the alias table contains any new and/or old names.
|
||||||
|
|
|
@ -710,3 +710,8 @@ blockquote {
|
||||||
margin: inherit;
|
margin: inherit;
|
||||||
border-left: inherit;
|
border-left: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#emails {
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-right: 4px;
|
||||||
|
}
|
||||||
|
|
|
@ -34,14 +34,16 @@
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-5" id="emails">
|
<div class="col-sm-5" id="emails">
|
||||||
{% for email in emails %}
|
<table class="table table-condensed">
|
||||||
<div class="checkbox">
|
<tr ><th>Primary</th><th>Active</th><th>Address</th></tr>
|
||||||
<label>
|
{% for email in emails %}
|
||||||
<input type="checkbox" name="active_emails" value="{{ email.pk }}" {% if email.active %}checked{% endif %}>
|
<tr >
|
||||||
{{ email }}
|
<td><input type="radio" name="primary_email" value="{{ email.pk }}" {% if email.primary %}checked{% endif %}></td>
|
||||||
</label>
|
<td><input type="checkbox" name="active_emails" value="{{ email.pk }}" {% if email.active %}checked{% endif %}></td>
|
||||||
</div>
|
<td>{{ email }}</td>
|
||||||
{% endfor %}
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<div class="help-block">Note: Email addresses cannot be deleted, only deactivated.</div>
|
<div class="help-block">Note: Email addresses cannot be deleted, only deactivated.</div>
|
||||||
|
@ -81,11 +83,11 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("input[name=active_emails]").on("change keypress click", function () {
|
$("input[name=active_emails]").on("change keypress click", function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$(this).parent().addClass("text-success");;
|
$(this).parent().parent().addClass("text-success");;
|
||||||
$(this).parent().removeClass("text-danger line-through");
|
$(this).parent().parent().removeClass("text-danger line-through");
|
||||||
} else {
|
} else {
|
||||||
$(this).parent().addClass("text-danger line-through");
|
$(this).parent().parent().addClass("text-danger line-through");
|
||||||
$(this).parent().removeClass("text-success");
|
$(this).parent().parent().removeClass("text-success");
|
||||||
}
|
}
|
||||||
}).trigger("change");
|
}).trigger("change");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue