{% extends "admin/base_site.html" %}
{% load i18n static %}
{% load admin_urls %}

{% block javascripts %}
    <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>

    {{ block.super }}
{% endblock javascripts %}

{% block stylesheets %}
    <link rel="stylesheet" type="text/css" href="{% static 'admin/css/forms.css' %}">

    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static 'adminlte2_admin/css/forms.css' %}">
{% endblock stylesheets %}

{% block body_class %}{{ block.super }} {{ opts.app_label }}-{{ opts.model_name }} change-form{% endblock body_class %}

{% if not is_popup %}
    {% block breadcrumbs %}
        <li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li>
        <li><a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a></li>
        <li><a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a></li>
        <li><a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">{{ original|truncatewords:"18" }}</a></li>
        <li>{% trans 'Change password' %}</li>
    {% endblock breadcrumbs %}
{% endif %}

{% block content %}
<div id="container-fluid content-main">
    <form action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">

        {% csrf_token %}

        {% block form_top %}{% endblock form_top %}

        <input type="text" name="username" value="{{ original.get_username }}" style="display: none;">

        <div>
            {% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %}

            {% if form.errors %}
                <div class="alert alert-danger alert-dismissible">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <p class="errornote">
                        <i class="icon fa fa-ban"></i>
                        {% if form.errors.items|length == 1 %}
                            {% trans "Please correct the error below." %}
                        {% else %}
                            {% trans "Please correct the errors below." %}
                        {% endif %}
                    </p>
                </div>
            {% endif %}

            <p>
                {% blocktrans with username=original %}
                    Enter a new password for the user <strong>{{ username }}</strong>.
                {% endblocktrans %}
            </p>

            <fieldset class="module aligned">

                <div class="form-row form-group">
                    {{ form.password1.errors }}
                    {{ form.password1.label_tag }} {{ form.password1 }}
                    {% if form.password1.help_text %}
                    <span class="help-block">{{ form.password1.help_text|safe }}</span>
                    {% endif %}
                </div>

                <div class="form-row form-group">
                    {{ form.password2.errors }}
                    {{ form.password2.label_tag }} {{ form.password2 }}
                    {% if form.password2.help_text %}
                    <span class="help-block">{{ form.password2.help_text|safe }}</span>
                    {% endif %}
                </div>

            </fieldset>

            <div class="submit-row">
                <input type="submit" value="{% trans 'Change password' %}" class="default">
            </div>

        </div>
    </form>
</div>
{% endblock content %}
