{% extends "one_column_body.html" %}
{% import "macros.html" as macros %}
<!-- user_edit.html -->
{% block title %}{% filter trim %}{% trans %}Edit user profile{% endtrans %}{% endfilter %}{% endblock %}
{% block layout_class %}{{ super() }} edit-user-profile-page{% endblock %}
{% block content %}
<h1>{{ view_user.username|escape }} - {% trans %}edit profile{% endtrans %}</h1>
<div class='avatar'>
    {{ macros.gravatar(view_user, 128, hide_rep=True) }}
    {% if request.user.pk == view_user.pk %}
        <p><a
            {% if support_custom_avatars %}
                href="{{ url('askbot_avatar_show_list',  view_user.pk ) }}"
            {% else %}
                href="{{ url('faq') }}#gravatar"
            {% endif %}
        >{% trans %}change picture{% endtrans %}</a></p>
    {% endif %}
</div>
<form name="" action="{{ url('edit_user',  view_user.id ) }}" method="post">{{ csrf_input }}
    <table class="user-details">
        <tr>
            <td>{{ form.username.label_tag() }}</td>
            <td>
                {% if settings.EDITABLE_SCREEN_NAME %}
                    {{ form.username }}
                    <span class="form-error"> {{ form.username.errors }} </span>
                {% else %}
                    {{ view_user.username|escape }}
                {% endif %}
            </td>
        </tr>
        <tr>
            <td>{{ form.email.label_tag() }}</td>
            <td>
                {% if settings.EDITABLE_EMAIL %}
                    {{ form.email }}
                    <span class="form-error">{{ form.email.errors }}</span>
                {% else %}
                    {{ view_user.email }}
                    {% trans %}(cannot be changed){% endtrans %}
                {% endif %}
            </td>
        </tr>
        <tr>
            <td>{{ form.realname.label_tag() }}</td>
            <td>{{ form.realname }} <span class="form-error"> {{ form.realname.errors }} </span></td>
        </tr>
        <tr>
            <td>{{ form.website.label_tag() }}</td>
            <td>{{ form.website }} <span class="form-error"> {{ form.website.errors }} </span></td>
        </tr>
        <tr>
            <td>{{ form.city.label_tag() }}</td>
            <td>{{ form.city }} <span class="form-error"> {{ form.city.errors }} </span></td>
        </tr>
        <tr>
            <td>{{ form.country.label_tag() }}</td>
            <td>{{ form.country }} <span class="form-error"> {{ form.country.errors }} </span></td>
        </tr>
        <tr>
            <td>{{ form.show_country.label_tag() }}</td>
            <td>{{ form.show_country }} <span class="form-error"> {{ form.show_country.errors }} </span></td>
        </tr>
        {% if marked_tags_setting == 'when-user-wants' %}
        <tr>
            <td>{{ form.show_marked_tags.label_tag() }}</td>
            <td>{{ form.show_marked_tags }}
                <span class="form-error">{{ form.show_marked_tags.errors }}</span>
            </td>
        </tr>
        {% endif %}
    </table>
    <input class="btn" type="submit" value="{% trans %}Update{% endtrans %}"/>
    <input class="btn btn-muted" id="cancel" type="button" value="{% trans %}Cancel{% endtrans %}"/>
</form>
{% endblock %}
{% block endjs %}
    <script type="text/javascript">
        $().ready(function(){
            $("#nav_profile").attr('className',"on");
            $("#cancel").bind('click', function(){history.go(-1);})
        });
    </script>
    {% block userjs %}
    {% endblock %}
{% endblock %}
<!-- end user_edit.html -->
