datatracker/ietf/templates/registration/edit_profile.html
Ole Laursen a99aa32c59 Refactor account code to use the built-in Django signing framework
(reusing code previously written for the community lists) instead of
the a custom MD5 scheme, add tests of all views, rewrite custom form
handling code to use plain forms and ensure that the data is properly
validated and errors visible in the UI. Move help texts on the Person
form up to the model.
 - Legacy-Id: 11136
2016-04-27 16:26:04 +00:00

96 lines
2.8 KiB
HTML

{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load widget_tweaks bootstrap3 %}
{% block title %}Profile for {{ user }}{% endblock %}
{% block content %}
{% origin %}
<h1>Profile for {{ user.username }}</h1>
<form class="form-horizontal" method="post">
{% csrf_token %}
{% bootstrap_form_errors person_form 'non_fields' %}
<div class="form-group">
<label class="col-sm-2 control-label">User name</label>
<div class="col-sm-10">
<p class="form-control-static">{{ user.username }}</p>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Email addresses</label>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-5" id="emails">
{% for email in emails %}
<div class="checkbox">
<label>
<input type="checkbox" name="active_emails" value="{{ email.pk }}" {% if email.active %}checked{% endif %}>
{{ email }}
</label>
</div>
{% endfor %}
</div>
<div class="col-sm-7">
<div class="help-block">Note: Email addresses cannot be deleted, only deactivated.</div>
</div>
</div>
</div>
</div>
{% for f in new_email_forms %}
{% bootstrap_field f.new_email layout="horizontal" show_label=False %}
{% endfor %}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="new-emails"></div>
<button class="btn btn-default btn-sm add-email">Add email address</button>
</div>
</div>
{% for role in roles %}
{% bootstrap_field role.email_form.email layout="horizontal" show_label=False %}
{% endfor %}
{% bootstrap_form person_form layout="horizontal" %}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
{% endblock %}
{% block js %}
<script>
$(document).ready(function() {
$("input[name=active_emails]").on("change keypress click", function () {
if (this.checked) {
$(this).parent().addClass("text-success");;
$(this).parent().removeClass("text-danger line-through");
} else {
$(this).parent().addClass("text-danger line-through");
$(this).parent().removeClass("text-success");
}
}).trigger("change");
$(".add-email").click(function(e) {
e.preventDefault();
var container = $(this).closest("form").find(".new-emails");
$('<input class="form-control" name="new_email" placeholder="Enter new email address...">').appendTo(container).focus();
})
});
</script>
{% endblock %}