|
@@ -39,6 +39,7 @@ from coderedcms import schema, utils
|
|
|
from coderedcms.blocks import (
|
|
|
CONTENT_STREAMBLOCKS,
|
|
|
LAYOUT_STREAMBLOCKS,
|
|
|
+ ContentWallBlock,
|
|
|
OpenHoursBlock,
|
|
|
StructuredDataActionBlock)
|
|
|
from coderedcms.forms import CoderedFormBuilder, CoderedSubmissionsListView
|
|
@@ -275,6 +276,23 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
|
|
|
)
|
|
|
|
|
|
|
|
|
+ ###############
|
|
|
+ # Settings
|
|
|
+ ###############
|
|
|
+
|
|
|
+ content_walls = StreamField(
|
|
|
+ [
|
|
|
+ ('content_wall', ContentWallBlock())
|
|
|
+ ],
|
|
|
+ blank=True,
|
|
|
+ verbose_name=_('Content Walls')
|
|
|
+ )
|
|
|
+ show_content_wall_on_children = models.BooleanField(
|
|
|
+ default=False,
|
|
|
+ verbose_name=_('Show content walls on children pages?'),
|
|
|
+ help_text=_('If this is checked, the content walls will be displayed on all children pages of this page.')
|
|
|
+ )
|
|
|
+
|
|
|
###############
|
|
|
# Search
|
|
|
###############
|
|
@@ -367,7 +385,19 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
|
|
|
),
|
|
|
]
|
|
|
|
|
|
- settings_panels = Page.settings_panels
|
|
|
+ settings_panels = (
|
|
|
+ Page.settings_panels +
|
|
|
+ [
|
|
|
+ MultiFieldPanel(
|
|
|
+ [
|
|
|
+ StreamFieldPanel('content_walls'),
|
|
|
+ FieldPanel('show_content_wall_on_children'),
|
|
|
+ ],
|
|
|
+ heading=_('Content Wall Settings'),
|
|
|
+ )
|
|
|
+
|
|
|
+ ]
|
|
|
+ )
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
"""
|
|
@@ -445,6 +475,18 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
|
|
|
|
|
|
return super().get_children().live()
|
|
|
|
|
|
+ def get_content_walls(self, check_child_setting=True):
|
|
|
+ current_content_walls = []
|
|
|
+
|
|
|
+ if check_child_setting:
|
|
|
+ current_content_walls = self.content_walls if self.show_content_wall_on_children else []
|
|
|
+ else:
|
|
|
+ current_content_walls = self.content_walls
|
|
|
+ try:
|
|
|
+ return list(current_content_walls) + self.get_parent().specific.get_content_walls()
|
|
|
+ except AttributeError:
|
|
|
+ return list(current_content_walls)
|
|
|
+
|
|
|
def get_context(self, request, *args, **kwargs):
|
|
|
"""
|
|
|
Add child pages and paginated child pages to context.
|
|
@@ -462,7 +504,7 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
|
|
|
|
|
|
context['index_paginated'] = paged_children
|
|
|
context['index_children'] = all_children
|
|
|
-
|
|
|
+ context['content_walls'] = self.get_content_walls(check_child_setting=False)
|
|
|
return context
|
|
|
|
|
|
|