{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia cms_js_tags cms_admin %}

{% block title %}{% trans "Change a page" %}{% endblock %}

{% block extrahead %}
	<script type="text/javascript" src="{% admin_static_url %}js/jquery.min.js"></script>
	{{ media }}
{% endblock %}

{% block content_title %}{% endblock %}

{% block content %}
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function ($) {
	// if it is an iframe
	if(window.parent != self) {
		if (typeof window.parent.CMS === 'undefined'){
			// backend admin
			{% if deleted %}
			// delete plugin selector if cancelled before adding content
        	window.parent.removed_cancelled_plugin({{ plugin_id }});
        	{% endif %}
        parent.hide_iframe({{ plugin_id }}, {% javascript_string %}{{ type }}{% end_javascript_string %}, {% javascript_string %}{{ name }}{% end_javascript_string %}, {% javascript_string %}
        	{% if cancel %}{% trans "Your changes to this plugin have not been saved." %}{% else %}{% trans "Plugin saved successfully." %}{% endif %}
        	{% end_javascript_string %});
        	
		} else {
			// frontend edit
			setTimeout(function () { window.parent.CMS.API.Helpers.reloadBrowser(); }, 1000);
		}
	} else {
        opener.dismissEditPluginPopup(window, {% javascript_string %}{{ plugin_id }}{% end_javascript_string %}, {% javascript_string %}{{ icon }}{% end_javascript_string %}, {% javascript_string %}{{ alt }}{% end_javascript_string %});
	}
});
//]]>
</script>
{% endblock %}
