Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changing plugin form to new place. this will break a lot!

  • Loading branch information...
commit 35941e152f317c8a1ca755389d0ad05872dc6c43 1 parent 8ce126a
@FinalAngel FinalAngel authored
View
8 cms/admin/pageadmin.py
@@ -1285,7 +1285,7 @@ def edit_plugin(self, request, plugin_id):
context.update({
"deleted":True,
})
- return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
+ return render_to_response('admin/cms/page/plugin/form-confirm.html', context, RequestContext(request))
if not instance:
# instance doesn't exist, call add view
@@ -1322,7 +1322,7 @@ def edit_plugin(self, request, plugin_id):
'icon': force_escape(saved_object.get_instance_icon_src()),
'alt': force_escape(saved_object.get_instance_icon_alt()),
}
- return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
+ return render_to_response('admin/cms/page/plugin/form-confirm.html', context, RequestContext(request))
return response
@@ -1547,9 +1547,9 @@ def edit_title(self, request, page_id):
context.update({
'cancel': True,
})
- return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
+ return render_to_response('admin/cms/page/plugin/form-confirm.html', context, RequestContext(request))
if not cancel_clicked and request.method == 'POST' and saved_successfully:
- return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
+ return render_to_response('admin/cms/page/plugin/form-confirm.html', context, RequestContext(request))
return render_to_response('admin/cms/page/page_attribute_change_form.html', context, RequestContext(request))
View
4 cms/admin/placeholderadmin.py
@@ -220,7 +220,7 @@ def edit_plugin(self, request, plugin_id):
context.update({
"deleted":True,
})
- return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
+ return render_to_response('admin/cms/page/plugin/form-confirm.html', context, RequestContext(request))
if not instance:
# instance doesn't exist, call add view
@@ -247,7 +247,7 @@ def edit_plugin(self, request, plugin_id):
'icon': force_escape(saved_object.get_instance_icon_src()),
'alt': force_escape(escapejs(saved_object.get_instance_icon_alt())),
}
- return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request))
+ return render_to_response('admin/cms/page/plugin/form-confirm.html', context, RequestContext(request))
return response
View
39 cms/templates/admin/cms/page/plugin/form-confirm.html
@@ -0,0 +1,39 @@
+{% extends "admin/change_form.html" %}
+{% load i18n admin_modify adminmedia cms_js_tags cms_admin %}
+{% comment %}
+- This template is used whenever a plugin has been saved
+{% endcomment %}
+
+{% block extrahead %}
+<script type="text/javascript" src="{% admin_static_url %}js/jquery.min.js"></script>
+{{ media }}
+{% endblock %}
+
+{% block title %}{% trans "Change a page" %}{% endblock %}
+{% block content_title %}{% endblock %}
+
+{% block content %}
+<script type="text/javascript">
+jQuery(document).ready(function ($) {
+ // determine how to handle the plugin call
+ var type = '{% if deleted %}delete{% else %}add{% endif %}';
+ if(window.parent.CMS) type = 'popup';
+ // extra context that can be passed to the calling function
+ // TODO: context should be passed through the backend
+ var context = {
+ 'window': window,
+ 'plugin_id': '{{ plugin_id }}', // used for everything
+ 'plugin_type': {{ type }}, // used for hide_iframe
+ 'plugin_name': {{ name }}, // used for hide_iframe
+ 'plugin_icon': '{{ icon }}', // used for wysiwyg
+ 'plugin_desc': '{{ alt }}', // used for wysiwyg
+ 'timeout': {{ window_close_timeout|default:0 }},
+ 'message': '{% if cancel %}{% trans "Your changes to this plugin have not been saved." %}{% else %}{% trans "Plugin saved successfully." %}{% endif %}'
+ };
+
+ // determing if we are inside the current window or in a popup
+ if(window.CMS) CMS.API.Helpers.Save(type, context);
+ if(window.parent.CMS) window.parent.CMS.API.Helpers.Save(type, context);
+});
+</script>
+{% endblock %}
View
39 cms/templates/admin/cms/page/plugin_forms_ok.html
@@ -1,39 +0,0 @@
-{% 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(); }, {{ window_close_timeout|default: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 %}
Please sign in to comment.
Something went wrong with that request. Please try again.