{% extends "sentry/bases/account.html" %}

{% load crispy_forms_tags %}
{% load i18n %}
{% load sentry_helpers %}

{% block title %}{% trans "Account Settings" %} | {{ block.super }}{% endblock %}

{% block inner %}
    <form action="" method="post">
        {% csrf_token %}
        {{ form|as_crispy_errors }}
        {% with form.first_name as field %}
            {{ field|as_crispy_field }}
        {% endwith %}
        {% if form.username %}
            {% with form.username as field %}
                {{ field|as_crispy_field }}
            {% endwith %}
        {% endif %}
        {% with form.email as field %}
            {{ field|as_crispy_field }}
        {% endwith %}
        <fieldset class="control-group">
            <label>Avatar</label>
            <div class="controls">
                <img class="avatar" src="{% gravatar_url user.email size 32 %}">
                <a href="http://gravatar.com/">Change your avatar at Gravatar.com</a>
            </div>
        </fieldset>
        {% if form.new_password %}
        <hr>
        <p>{% trans "You may also optionally change your password." %}</p>
        {% with form.new_password as field %}
            {{ field|as_crispy_field }}
        {% endwith %}
        {% endif %}

        {% if not form.is_readonly %}
        <fieldset class="form-actions">
            <button type="submit" class="btn btn-primary">{% trans "Save Changes" %}</button>
        </fieldset>
        {% endif %}
    </form>
{% endblock %}
