summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2014-05-26 18:41:43 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2014-05-26 18:41:43 (GMT)
commitca8a9418dc632d6d3e4813754a12b9b78a784fa4 (patch)
tree684d9d67d5eef8c21085e3610f33db38d65a1d28
parent735ca6320b7e1b78532a95496994807f7a94aec9 (diff)
downloadcms-ajax-text-plugin-ca8a9418dc632d6d3e4813754a12b9b78a784fa4.zip
cms-ajax-text-plugin-ca8a9418dc632d6d3e4813754a12b9b78a784fa4.tar.gz
cms-ajax-text-plugin-ca8a9418dc632d6d3e4813754a12b9b78a784fa4.tar.bz2
cms_plugins: pass the instance to the template producing the ajax code
-rw-r--r--cms_ajax_text_plugin/cms_plugins.py1
-rw-r--r--cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html4
2 files changed, 3 insertions, 2 deletions
diff --git a/cms_ajax_text_plugin/cms_plugins.py b/cms_ajax_text_plugin/cms_plugins.py
index 57144a3..0c4eb2e 100644
--- a/cms_ajax_text_plugin/cms_plugins.py
+++ b/cms_ajax_text_plugin/cms_plugins.py
@@ -14,6 +14,7 @@ class AjaxTextPlugin(TextPlugin):
def render(self, context, instance, placeholder):
request = context.get('request')
+ context['instance'] = instance
if 'updatecache' in request.GET:
instance.args = '?updatecache'
edit_mode = request and 'edit' in request.GET
diff --git a/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html b/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html
index fc8961b..4d0eade 100644
--- a/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html
+++ b/cms_ajax_text_plugin/templates/cms_ajax_text_plugin/plugin.html
@@ -6,12 +6,12 @@
{% addtoblock "js" %}
<script type="text/javascript">
$(document).ready(function(){
- $("#plugin-{{ object.id }}").load('{% url 'ajax_render' object.id %}{{ object.args|safe }}');
+ $("#plugin-{{ instance.id }}").load('{% url 'ajax_render' instance.id %}{{ instance.args|safe }}');
});
</script>
{% endaddtoblock %}
-<div id="plugin-{{ object.id }}" class='cms-ajax-text-plugin'>
+<div id="plugin-{{ instance.id }}" class='cms-ajax-text-plugin'>
<div class='cms-ajax-text-plugin-loading'>
{% trans "loading..." %}
</div>