{% extends "admin/change_form.html" %}{% load i18n cms_tags %}

{% block extrahead %}
{{ block.super }}
<script>
    // we have to wait till the window is loaded, otherwise
    // the sideframe code will override the url, because every time
    // the iframe is loaded, it's current url is saved in the settings
    window.onload = function () {
        // we have to setTimeout here because the cms.sideframe load event
        // fires after this one :(
        setTimeout(function () {
            var CMS = window.parent.CMS;
            // we need to reload the parent window once "?reload_window" is defined and
            // set the new url for the sideframe with the correct language specification
            if (location.href.indexOf('reload_window') > -1 && CMS) {
                // save url in settings
                CMS.settings.sideframe.url = window.location.href.replace(/[?&]reload_window/, '');
                CMS.settings = CMS.API.Helpers.setSettings(CMS.settings);
                // reload everything
                CMS.API.Helpers.reloadBrowser();
            }
        }, 0);
    }
</script>
{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href="{% cms_admin_url 'index' %}">{% trans 'Home' %}</a>
    &rsaquo; <a href="{% cms_admin_url 'app_list' app_label=opts.app_label %}">{{ app_label|capfirst|escape }}</a>
    &rsaquo; {{ opts.verbose_name_plural|capfirst }}
    &rsaquo; {% if add %}{% trans 'Add' %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
</div>
{% endblock %}

{% block object-tools %}{% endblock %}

{% block submit_buttons_bottom %}
<div class="submit-row">
    <input type="submit" value="{% trans 'Save' %}" class="default" name="_save" {{ onclick_attrib }}/>
</div>
{% endblock %}
