Skip to content

Commit

Permalink
Moved child-plugin-classes templates out of "js" sekizai block
Browse files Browse the repository at this point in the history
In commit 4f2ec23, a ``<script type="text/cms-template">`` (for
holding client-side content that is not to be rendered until
runtime, and which we will use until the HTML element
``<template>`` is fully supported) was placed inside a Sekizai
block where it would not interfere with page rendering.

Unfortunately, this turned out to be incompatible with Django
Compressor #5454, which
raises an error on the (deliberately invalid)
``type="text/cms-template"``.

It has been moved out of the Sekizai block to fix this problem. The
render-blocking effects of the script are negligible.
  • Loading branch information
vxsx committed Jun 29, 2016
1 parent 3481558 commit cc2a0e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Expand Up @@ -32,6 +32,8 @@
mode.
* Fixed a bug where users with limited permissions could not interact with
page tree dropdowns.
* Fixed a bug where Django Compressor could not be used on the sekizai ``js``
block.


=== 3.3.0 (2016-05-26) ===
Expand Down
8 changes: 5 additions & 3 deletions cms/templates/cms/toolbar/placeholder.html
Expand Up @@ -2,6 +2,11 @@
{% load i18n l10n sekizai_tags %}

<div class="cms-placeholder cms-placeholder-{{ placeholder.pk|unlocalize }}"></div>
{% language request.toolbar.toolbar_language %}
<script id="cms-plugin-child-classes-{{ placeholder.pk|unlocalize }}" type="text/cms-template">
{% include request.toolbar.drag_item_menu_template %}
</script>
{% endlanguage %}

{% endspaceless %}{% addtoblock "js" %}
{% language request.toolbar.toolbar_language %}
Expand All @@ -20,8 +25,5 @@
}
}]);
</script>
<script id="cms-plugin-child-classes-{{ placeholder.pk|unlocalize }}" type="text/cms-template">
{% include request.toolbar.drag_item_menu_template %}
</script>
{% endlanguage %}
{% endaddtoblock %}
13 changes: 9 additions & 4 deletions cms/tests/test_toolbar.py
Expand Up @@ -1058,10 +1058,15 @@ def test_edit_render_placeholder(self):
response = detail_view(request, ex1.pk, template_string=template_text)
self.assertContains(
response,
'<h1><div class="cms-placeholder cms-placeholder-{0}"></div>\n'
'<div class="cms-plugin cms-plugin-{1}">{2}</div></h1>'.format(ex1.placeholder.pk,
plugin.pk, render_placeholder_body)
)
'<h1><div class="cms-placeholder cms-placeholder-{0}"></div>'.format(ex1.placeholder.pk))

self.assertContains(
response,
'<script id="cms-plugin-child-classes-{0}" type="text/cms-template">'.format(ex1.placeholder.pk))

self.assertContains(
response,
'<div class="cms-plugin cms-plugin-{0}">{1}</div></h1>'.format(plugin.pk, render_placeholder_body))

self.assertContains(
response,
Expand Down

0 comments on commit cc2a0e5

Please sign in to comment.