summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2014-02-10 07:37:17 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2014-02-10 07:37:17 (GMT)
commit7f1027f956ab72d05afb55bcc0e9a4183591962b (patch)
tree09f4a1bd2a009e33f89dbb1daee3e4528aa31bc8
parentfc17cd46899ea64f6e113e8add858f54819531a5 (diff)
downloadcms-ajax-text-plugin-7f1027f956ab72d05afb55bcc0e9a4183591962b.zip
cms-ajax-text-plugin-7f1027f956ab72d05afb55bcc0e9a4183591962b.tar.gz
cms-ajax-text-plugin-7f1027f956ab72d05afb55bcc0e9a4183591962b.tar.bz2
views,templates: render sekizai js and css blocks when rendering a plugin out of page
It's needed bug plugin with js behavior.
-rw-r--r--cms_ajax_text_plugin/cms_plugins.py2
-rw-r--r--cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html (renamed from cms_ajax_text_plugin/templates/plugin/ajax_text.html)0
-rw-r--r--cms_ajax_text_plugin/templates/cms_ajax_text_plugin/view.html4
-rw-r--r--cms_ajax_text_plugin/views.py5
4 files changed, 8 insertions, 3 deletions
diff --git a/cms_ajax_text_plugin/cms_plugins.py b/cms_ajax_text_plugin/cms_plugins.py
index dbdbcbd..9cd5f8a 100644
--- a/cms_ajax_text_plugin/cms_plugins.py
+++ b/cms_ajax_text_plugin/cms_plugins.py
@@ -6,7 +6,7 @@ from cms.plugin_pool import plugin_pool
class AjaxTextPlugin(TextPlugin):
name = _(u'Text (asynchronous loading)')
- ajax_render_template = 'plugin/ajax_text.html'
+ ajax_render_template = 'cms_ajax_text_plugin/plugin.html'
text_enabled = True
def get_ajax_body(self, instance, context):
diff --git a/cms_ajax_text_plugin/templates/plugin/ajax_text.html b/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html
index fc8961b..fc8961b 100644
--- a/cms_ajax_text_plugin/templates/plugin/ajax_text.html
+++ b/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html
diff --git a/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/view.html b/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/view.html
new file mode 100644
index 0000000..7fa9ee7
--- /dev/null
+++ b/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/view.html
@@ -0,0 +1,4 @@
+{% load sekizai_tags %}
+{{ content|safe }}
+{% render_block "js" %}
+{% render_block "css" %}
diff --git a/cms_ajax_text_plugin/views.py b/cms_ajax_text_plugin/views.py
index b0e19b8..5ad244a 100644
--- a/cms_ajax_text_plugin/views.py
+++ b/cms_ajax_text_plugin/views.py
@@ -1,5 +1,5 @@
-from django.http import HttpResponse
from django.template import RequestContext
+from django.shortcuts import render_to_response
from cms.models import CMSPlugin
@@ -8,4 +8,5 @@ def ajax_render(request, plugin_id):
plugin = CMSPlugin.objects.get(pk=plugin_id)
context = RequestContext(request)
rendered = plugin.render_plugin(context)
- return HttpResponse(rendered)
+ return render_to_response('cms_ajax_text_plugin/view.html',
+ {'content': rendered}, context)