{% extends "admin/change_form.html" %}
{% load i18n l10n static cms_static %}

{% block content %}
<div class="messagelist">
    <div class="success"></div>
</div>
<script>
window.CMS || window.parent.CMS || document.write(
    '<script src="{% static_with_version "cms/js/dist/bundle.admin.base.min.js" %}" type="text/javascript"><\/script>'
);
</script>
<script>
    // we have a special case here cause the CMS namespace
    // can be either inside the current window or the parent
    (function(Window) {
        Window.CMS.$(document).ready(function () {
            // make sure we're doing after the "modal" mechanism kicked in
            setTimeout(function () {
                {% if replaced_placeholder %}
                Window.CMS.API.StructureBoard.invalidateState('CLEAR_PLACEHOLDER', {{ replaced_placeholder|safe }});
                {% else %}
                Window.CMS.API.StructureBoard.invalidateState('DELETE', {{ replaced_plugin|safe }});
                {% endif %}
                {% for added_plugin, structure in added_plugins %}
                var addedPlugin = {{ added_plugin|safe }};
                addedPlugin.structure = {{ structure|safe }};
                Window.CMS.API.StructureBoard.invalidateState('ADD', addedPlugin);
                {% endfor %}
                {% for moved_plugin in moved_plugins %}
                var moveData = {{ moved_plugin|safe }};
                Window.CMS.API.StructureBoard.invalidateState('MOVE', moveData);
                {% endfor %}

                Window.CMS.API.StructureBoard._requestcontent = null;
                Window.CMS.API.StructureBoard.updateContent();
            }, 100);
        });
    })(window.parent || window);
</script>
{% endblock %}
