2
0
Cory Sutyak 6 жил өмнө
parent
commit
1cb5e5e164

+ 6 - 1
coderedcms/blocks/content_blocks.py

@@ -302,7 +302,12 @@ class ContentWallBlock(BaseBlock):
     Enables choosing a ContentWall snippet.
     """
     content_wall = SnippetChooserBlock('coderedcms.ContentWall')
-
+    show_content_wall_on_children = blocks.BooleanBlock(
+        required=False,
+        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.')
+    )
     class Meta:
         icon = 'fa-stop'
         label = _('Content Wall')

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1 - 1
coderedcms/migrations/0002_auto_20180824_1550.py


+ 6 - 15
coderedcms/models/page_models.py

@@ -287,11 +287,6 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
         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
@@ -388,14 +383,7 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
     settings_panels = (
         Page.settings_panels + 
         [
-            MultiFieldPanel(
-                [
-                    StreamFieldPanel('content_walls'),
-                    FieldPanel('show_content_wall_on_children'),
-                ],
-                heading=_('Content Wall Settings'),
-            )
-
+            StreamFieldPanel('content_walls'),
         ]
     )
 
@@ -477,11 +465,14 @@ class CoderedPage(Page, metaclass=CoderedPageMeta):
 
     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 []
+            for wall in self.content_walls:
+                content_wall = wall.value
+                if wall.value['show_content_wall_on_children']:
+                    current_content_walls.append(wall.value)
         else:
             current_content_walls = self.content_walls
+            
         try:
             return list(current_content_walls) + self.get_parent().specific.get_content_walls()
         except AttributeError:

+ 4 - 1
coderedcms/static/js/codered-front.js

@@ -102,5 +102,8 @@ $(document).ready(function()
     });
 
     /*** Content Walls ***/
-    $('.content-wall').modal('show')
+    $('.content-wall').modal({
+        backdrop: 'static',
+        keyboard: false
+    });
 });

+ 1 - 1
coderedcms/templates/coderedcms/blocks/content_wall_block.html

@@ -13,7 +13,7 @@
             </div>
             {% endif %}
             <div class="modal-body">
-                {{self.content_wall.content}}
+                {{self.content_wall.content}}                
             </div>
         </div>
     </div>

+ 1 - 1
coderedcms/templates/coderedcms/pages/base.html

@@ -106,7 +106,7 @@
         <div id="content-walls">
             {% block content_walls %}
                 {% for content_wall in content_walls %}
-                        {{content_wall}}
+                        {% include_block content_wall with settings=settings %}
                 {% endfor %}
             {% endblock %}
         </div>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно