new plugins section
This commit is contained in:
parent
b3742ed3f7
commit
bbfb37dd8f
8 changed files with 118 additions and 50 deletions
|
@ -200,3 +200,38 @@ class DCLSectionImagePluginModel(CMSPlugin):
|
||||||
max_length=100, null=True, blank=True,
|
max_length=100, null=True, blank=True,
|
||||||
help_text='Optional caption for the image.'
|
help_text='Optional caption for the image.'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DCLSectionPromoPluginModel(CMSPlugin):
|
||||||
|
background_image = FilerImageField(
|
||||||
|
on_delete=models.CASCADE, null=True, blank=True,
|
||||||
|
help_text=('Optional background image for the Promo Section'),
|
||||||
|
related_name="dcl_section_promo_promo",
|
||||||
|
)
|
||||||
|
heading = models.CharField(
|
||||||
|
blank=True, null=True, max_length=100,
|
||||||
|
help_text='An optional heading for the Promo Section',
|
||||||
|
)
|
||||||
|
subheading = models.CharField(
|
||||||
|
blank=True, null=True, max_length=200,
|
||||||
|
help_text='An optional subheading for the Promo Section',
|
||||||
|
)
|
||||||
|
content = HTMLField()
|
||||||
|
html_id = models.SlugField(
|
||||||
|
blank=True, null=True,
|
||||||
|
help_text=(
|
||||||
|
'An optional html id for the Section. Required to set as target '
|
||||||
|
'of a link on page'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
plain_heading = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text='Select to keep the heading style simpler.'
|
||||||
|
)
|
||||||
|
center_on_mobile = models.BooleanField(
|
||||||
|
default=False,
|
||||||
|
help_text='Select to center align content on small screens.'
|
||||||
|
)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return '#' + self.html_id if self.html_id else str(self.pk)
|
||||||
|
|
|
@ -5,7 +5,8 @@ from .cms_models import (
|
||||||
DCLBannerItemPluginModel, DCLBannerListPluginModel, DCLContactPluginModel,
|
DCLBannerItemPluginModel, DCLBannerListPluginModel, DCLContactPluginModel,
|
||||||
DCLFooterPluginModel, DCLLinkPluginModel, DCLNavbarDropdownPluginModel,
|
DCLFooterPluginModel, DCLLinkPluginModel, DCLNavbarDropdownPluginModel,
|
||||||
DCLSectionIconPluginModel, DCLSectionImagePluginModel,
|
DCLSectionIconPluginModel, DCLSectionImagePluginModel,
|
||||||
DCLSectionPluginModel, DCLNavbarPluginModel
|
DCLSectionPluginModel, DCLNavbarPluginModel,
|
||||||
|
DCLSectionPromoPluginModel
|
||||||
)
|
)
|
||||||
from .models import VMTemplate
|
from .models import VMTemplate
|
||||||
|
|
||||||
|
@ -18,7 +19,24 @@ class DCLSectionPlugin(CMSPluginBase):
|
||||||
render_template = "datacenterlight/cms/section.html"
|
render_template = "datacenterlight/cms/section.html"
|
||||||
cache = False
|
cache = False
|
||||||
allow_children = True
|
allow_children = True
|
||||||
child_classes = ['DCLSectionIconPlugin', 'DCLSectionImagePlugin']
|
child_classes = [
|
||||||
|
'DCLSectionIconPlugin', 'DCLSectionImagePlugin',
|
||||||
|
'DCLSectionPromoPlugin', 'UngleichHTMLPlugin'
|
||||||
|
]
|
||||||
|
|
||||||
|
def render(self, context, instance, placeholder):
|
||||||
|
context = super(DCLSectionPlugin, self).render(
|
||||||
|
context, instance, placeholder
|
||||||
|
)
|
||||||
|
context['children_to_right'] = []
|
||||||
|
context['children_to_left'] = []
|
||||||
|
if instance.child_plugin_instances is not None:
|
||||||
|
for child in instance.child_plugin_instances:
|
||||||
|
if child.__class__.__name__ == 'DCLSectionImagePluginModel':
|
||||||
|
context['children_to_right'].append(child)
|
||||||
|
else:
|
||||||
|
context['children_to_left'].append(child)
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
@plugin_pool.register_plugin
|
@plugin_pool.register_plugin
|
||||||
|
@ -41,6 +59,15 @@ class DCLSectionImagePlugin(CMSPluginBase):
|
||||||
require_parent = True
|
require_parent = True
|
||||||
|
|
||||||
|
|
||||||
|
@plugin_pool.register_plugin
|
||||||
|
class DCLSectionPromoPlugin(CMSPluginBase):
|
||||||
|
module = "Datacenterlight"
|
||||||
|
name = "DCL Section Promo Plugin"
|
||||||
|
model = DCLSectionPromoPluginModel
|
||||||
|
render_template = "datacenterlight/cms/section_promo.html"
|
||||||
|
cache = False
|
||||||
|
|
||||||
|
|
||||||
@plugin_pool.register_plugin
|
@plugin_pool.register_plugin
|
||||||
class DCLCalculatorPlugin(CMSPluginBase):
|
class DCLCalculatorPlugin(CMSPluginBase):
|
||||||
module = "Datacenterlight"
|
module = "Datacenterlight"
|
||||||
|
|
|
@ -107,10 +107,14 @@
|
||||||
var href = $(this).attr('href');
|
var href = $(this).attr('href');
|
||||||
$('.navbar-collapse').removeClass('in');
|
$('.navbar-collapse').removeClass('in');
|
||||||
$('.navbar-collapse').addClass('collapsing');
|
$('.navbar-collapse').addClass('collapsing');
|
||||||
if ($(href).length) {
|
if (href[0] === "#") {
|
||||||
$('html, body').animate({
|
if ($(href).length) {
|
||||||
scrollTop: $(href).offset().top - 50
|
$('html, body').animate({
|
||||||
}, 1000);
|
scrollTop: $(href).offset().top - 50
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
} else if (href) {
|
||||||
|
window.location = href;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,8 @@
|
||||||
<div class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
|
<div class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %}">
|
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %} split-text">
|
||||||
<div class="split-text">
|
{% include "datacenterlight/cms/includes/_section_split_content.html" %}
|
||||||
{% if instance.heading %}
|
|
||||||
<div class="{% if not instance.plain_heading %}split-title{% endif %}">
|
|
||||||
<h2>{{ instance.heading }}</h2>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if instance.content %}
|
|
||||||
<div class="split-description">
|
|
||||||
<div class="lead">
|
|
||||||
{{ instance.content }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %}">
|
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %}">
|
||||||
<div class="price-calc-section">
|
<div class="price-calc-section">
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{% load cms_tags %}
|
||||||
|
|
||||||
|
{% if instance.heading %}
|
||||||
|
<div class="{% if not instance.plain_heading %}split-title{% else %}split-title-plain{% endif %}">
|
||||||
|
<h2>{{ instance.heading }}</h2>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if instance.content %}
|
||||||
|
<div class="split-description">
|
||||||
|
<div class="lead">
|
||||||
|
{{ instance.content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if children_to_left|length %}
|
||||||
|
<div class="split-subsection lead">
|
||||||
|
{% for plugin in children_to_left %}
|
||||||
|
{% render_plugin plugin %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
|
@ -1,26 +1,15 @@
|
||||||
{% load cms_tags %}
|
{% load cms_tags %}
|
||||||
|
|
||||||
<div class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
|
<section class="split-section {{ instance.get_extra_classes }}" id="{{ instance.html_id }}">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% if instance.child_plugin_instances|length %}
|
{% if children_to_right|length %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %} split-text">
|
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-push-6{% endif %} split-text">
|
||||||
{% if instance.heading %}
|
{% include "datacenterlight/cms/includes/_section_split_content.html" %}
|
||||||
<div class="{% if not instance.plain_heading %}split-title{% else %}split-title-plain{% endif %}">
|
|
||||||
<h2>{{ instance.heading }}</h2>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if instance.content %}
|
|
||||||
<div class="split-description">
|
|
||||||
<div class="lead">
|
|
||||||
{{ instance.content }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %} split-figure">
|
<div class="col-sm-6 {% if instance.text_direction == 'right' %}col-sm-pull-6{% endif %} split-figure">
|
||||||
<div class="section-figure">
|
<div class="section-figure">
|
||||||
{% for plugin in instance.child_plugin_instances %}
|
{% for plugin in children_to_right %}
|
||||||
{% render_plugin plugin %}
|
{% render_plugin plugin %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,19 +17,8 @@
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="space">
|
<div class="space">
|
||||||
{% if instance.heading %}
|
{% include "datacenterlight/cms/includes/_section_split_content.html" %}
|
||||||
<div class="{% if not instance.plain_heading %}split-title{% else %}split-title-plain{% endif %}">
|
|
||||||
<h2>{{ instance.heading }}</h2>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if instance.content %}
|
|
||||||
<div class="split-description">
|
|
||||||
<div class="lead">
|
|
||||||
{{ instance.content }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<section class="promo-section">
|
||||||
|
{% if instance.heading %}
|
||||||
|
<h1>{{instance.heading}}</h1>
|
||||||
|
{% endif %}
|
||||||
|
{% if instance.subheading %}
|
||||||
|
<h1>{{instance.subheading}}</h1>
|
||||||
|
{% endif %}
|
||||||
|
{% if instance.content %}
|
||||||
|
<h1>{{instance.content}}</h1>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
|
@ -41,4 +41,9 @@ def multiply(value, arg):
|
||||||
:param arg:
|
:param arg:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
return value*arg
|
return value * arg
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter('instance_class')
|
||||||
|
def instance_class(obj):
|
||||||
|
return obj.__class__.__name__
|
||||||
|
|
Loading…
Reference in a new issue