8000 chore: Move from script tags containing dom elements to template tags by fsbraun · Pull Request #8233 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

chore: Move from script tags containing dom elements to template tags #8233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cms/plugin_rendering.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ def _preload_placeholders_for_page(self, page, slots=None, inherit=False):
class StructureRenderer(BaseRenderer):
load_structure = True
placeholder_edit_template = """
<script data-cms id="cms-plugin-child-classes-{placeholder_id}" type="text/cms-template">
<template data-cms id="cms-plugin-child-classes-{placeholder_id}" type="text/cms-template">
{plugin_menu_js}
</script>
</template>
{plugin_js}{placeholder_js}
"""

Expand Down Expand Up @@ -794,9 +794,9 @@ class LegacyRenderer(ContentRenderer):
placeholder_edit_template = """
{content}
<div class="cms-placeholder cms-placeholder-{placeholder_id}"></div>
<script data-cms id="cms-plugin-child-classes-{placeholder_id}" type="text/cms-template">
<template data-cms id="cms-plugin-child-classes-{placeholder_id}" type="text/cms-template">
{plugin_menu_js}
</script>
</template>
{plugin_js}{placeholder_js}
"""

Expand Down
4 changes: 2 additions & 2 deletions cms/tests/frontend/unit/fixtures/plugin_child_classes.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script id="cms-plugin-child-classes-1" type="text/cms-template">
<template id="cms-plugin-child-classes-1" type="text/cms-template">
<div class="cms-submenu-item cms-submenu-item-title"><span>Accordion</span></div>
<div class="cms-submenu-item"><a data-rel="add" href="Bootstrap3AccordionItemCMSPlugin">Accordion item</a></div>
<div class="cms-submenu-item cms-submenu-item-title"><span>Bootstrap3</span></div>
Expand Down Expand Up @@ -81,4 +81,4 @@
<div class="cms-submenu-item"><a data-rel="add" href="NewsBlogTagsPlugin">Tags</a></div>
<div class="cms-submenu-item cms-submenu-item-title"><span>People</span></div>
<div class="cms-submenu-item"><a data-rel="add" href="PeoplePlugin">People list</a></div>
</script>
</template>
4 changes: 2 additions & 2 deletions cms/tests/test_placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ def test_sets_source_when_external_object_is_rendered(self):
for placeholder in declared_placeholders:
self.assertContains(
response,
'<script data-cms id="cms-plugin-child-classes-%s" type="text/cms-template">'
'<template data-cms id="cms-plugin-child-classes-%s" type="text/cms-template">'
% placeholders.get(slot=placeholder.slot).pk,
)

Expand All @@ -1037,7 +1037,7 @@ def test_sets_source_when_external_object_is_rendered(self):
for placeholder in declared_placeholders:
self.assertContains(
response,
'<script data-cms id="cms-plugin-child-classes-%s" type="text/cms-template">'
'<template data-cms id="cms-plugin-child-classes-%s" type="text/cms-template">'
% placeholders.get(slot=placeholder.slot).pk,
)

Expand Down
Loading
0