From d006ddcf0db26b638e8b906d7ab842a22ca7edac Mon Sep 17 00:00:00 2001 From: PCoder Date: Sun, 19 Nov 2017 13:19:01 +0100 Subject: [PATCH] Add UngleichHeaderWithTextAndImageSliderPlugin and UngleichHeaderItemPlugin --- ungleich_page/cms_plugins.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ungleich_page/cms_plugins.py b/ungleich_page/cms_plugins.py index 4c842093..9d5cfda0 100644 --- a/ungleich_page/cms_plugins.py +++ b/ungleich_page/cms_plugins.py @@ -3,7 +3,8 @@ from cms.plugin_pool import plugin_pool from .models import ( UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, - About, AboutItem, SectionWithImage, UngleichServiceItem + About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader, + UngleichHeaderItem ) @@ -176,4 +177,35 @@ class UngleichServicesItemPlugin(CMSPluginBase): context, instance, placeholder ) context['instance'] = instance + return context + + +@plugin_pool.register_plugin +class UngleichHeaderWithTextAndImageSliderPlugin(CMSPluginBase): + name = "ungleich Header with Text and Image Slider Plugin" + model = UngleichHeader + render_template = "ungleich_page/ungleich/header.html" + cache = False + allow_children = True + child_classes = ['UngleichHeaderItemPlugin'] + + def render(self, context, instance, placeholder): + context['instance'] = instance + return context + + +@plugin_pool.register_plugin +class UngleichHeaderItemPlugin(CMSPluginBase): + name = "ungleich Header Item Plugin" + model = UngleichHeaderItem + render_template = "ungleich_page/ungleich/_header_item.html" + cache = False + require_parent = True + parent_classes = ['UngleichHeaderWithTextAndImageSliderPlugin'] + + def render(self, context, instance, placeholder): + context = super(UngleichHeaderItemPlugin, self).render( + context, instance, placeholder + ) + context['instance'] = instance return context \ No newline at end of file