summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei MIHAI <smihai@entrouvert.com>2014-02-05 14:49:06 (GMT)
committerSerghei MIHAI <smihai@entrouvert.com>2014-02-05 14:50:26 (GMT)
commita32c1fa9c8ebedd1298c47a935bb6ec8d2af63db (patch)
tree2e9f7018ecfcd8f18bb0837ac9e4358141cadb24
parent6338801048d8ebbc10f4349e263f1d9c0c31049b (diff)
downloadcms-ajax-text-plugin-a32c1fa9c8ebedd1298c47a935bb6ec8d2af63db.zip
cms-ajax-text-plugin-a32c1fa9c8ebedd1298c47a935bb6ec8d2af63db.tar.gz
cms-ajax-text-plugin-a32c1fa9c8ebedd1298c47a935bb6ec8d2af63db.tar.bz2
'updatecache' parameter passed explicitely to the plugins when present in GET
-rw-r--r--cms_ajax_text_plugin/cms_plugins.py8
-rw-r--r--cms_ajax_text_plugin/templates/plugin/ajax_text.html6
2 files changed, 6 insertions, 8 deletions
diff --git a/cms_ajax_text_plugin/cms_plugins.py b/cms_ajax_text_plugin/cms_plugins.py
index cd73a1f..dbdbcbd 100644
--- a/cms_ajax_text_plugin/cms_plugins.py
+++ b/cms_ajax_text_plugin/cms_plugins.py
@@ -3,14 +3,10 @@ from django.template import loader
from cmsplugin_text_wrapper.cms_plugins import TextPlugin
from cms.plugin_pool import plugin_pool
-from .models import TextWithExtraArgs
-from .forms import TextWithExtraArgsForm
class AjaxTextPlugin(TextPlugin):
name = _(u'Text (asynchronous loading)')
ajax_render_template = 'plugin/ajax_text.html'
- model = TextWithExtraArgs
- form = TextWithExtraArgsForm
text_enabled = True
def get_ajax_body(self, instance, context):
@@ -19,9 +15,11 @@ class AjaxTextPlugin(TextPlugin):
def render(self, context, instance, placeholder):
request = context.get('request')
+ if 'updatecache' in request.GET:
+ instance.args = '?updatecache'
+ context['object'] = instance
edit_mode = request and 'edit' in request.GET
is_ajax = request and request.is_ajax()
- context['object'] = instance
if edit_mode or is_ajax:
context = super(AjaxTextPlugin, self).render(context, instance, placeholder)
return context
diff --git a/cms_ajax_text_plugin/templates/plugin/ajax_text.html b/cms_ajax_text_plugin/templates/plugin/ajax_text.html
index fdffc44..fc8961b 100644
--- a/cms_ajax_text_plugin/templates/plugin/ajax_text.html
+++ b/cms_ajax_text_plugin/templates/plugin/ajax_text.html
@@ -6,13 +6,13 @@
{% addtoblock "js" %}
<script type="text/javascript">
$(document).ready(function(){
- $("#plugin-{{ object.id }}").load('{% url 'ajax_render' object.id %}?{{ object.args|safe }}');
+ $("#plugin-{{ object.id }}").load('{% url 'ajax_render' object.id %}{{ object.args|safe }}');
});
</script>
{% endaddtoblock %}
-<div id="plugin-{{ object.id }}">
- <div class="loading">
+<div id="plugin-{{ object.id }}" class='cms-ajax-text-plugin'>
+ <div class='cms-ajax-text-plugin-loading'>
{% trans "loading..." %}
</div>
</div>