Merge pull request #541 from pcoder/ungleich_cms_update_background_slider
Ungleich cms update background slider
This commit is contained in:
commit
8f89363126
5 changed files with 137 additions and 1 deletions
|
@ -5,7 +5,9 @@ from .models import (
|
|||
UngelichContactUsSection, UngelichTextSection, Service, ServiceItem,
|
||||
About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader,
|
||||
UngleichHeaderItem, UngleichProductItem, UngleichProduct, UngleichCustomer,
|
||||
UngleichCustomerItem, UngleichHTMLOnly, UngleichSimpleHeader
|
||||
UngleichCustomerItem, UngleichHTMLOnly, UngleichSimpleHeader,
|
||||
UngleichHeaderWithBackgroundImageSlider,
|
||||
UngleichHeaderWithBackgroundImageSliderItem
|
||||
)
|
||||
|
||||
|
||||
|
@ -224,6 +226,41 @@ class UngleichHeaderItemPlugin(CMSPluginBase):
|
|||
return context
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class UngleichHeaderBackgroundImageAndTextSliderPlugin(CMSPluginBase):
|
||||
name = "ungleich Header with Background and Image Slider Plugin"
|
||||
model = UngleichHeaderWithBackgroundImageSlider
|
||||
render_template = (
|
||||
'ungleich_page/ungleich/header_with_background_image_slider.html'
|
||||
)
|
||||
cache = False
|
||||
allow_children = True
|
||||
child_classes = ['UngleichHeaderBackgroundImageAndTextItemPlugin']
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context['instance'] = instance
|
||||
return context
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class UngleichHeaderBackgroundImageAndTextItemPlugin(CMSPluginBase):
|
||||
name = "ungleich Header with Background and Image and Text Item Plugin"
|
||||
model = UngleichHeaderWithBackgroundImageSliderItem
|
||||
render_template = (
|
||||
'ungleich_page/ungleich/_header_with_background_image_slider_item.html'
|
||||
)
|
||||
cache = False
|
||||
require_parent = True
|
||||
parent_classes = ['UngleichHeaderBackgroundImageAndTextSliderPlugin']
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context = super(
|
||||
UngleichHeaderBackgroundImageAndTextItemPlugin, self
|
||||
).render(context, instance, placeholder)
|
||||
context['instance'] = instance
|
||||
return context
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class UngleichProductsPlugin(CMSPluginBase):
|
||||
name = "ungleich Products Plugin"
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2017-12-02 07:30
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import djangocms_text_ckeditor.fields
|
||||
import filer.fields.image
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('filer', '0004_auto_20160328_1434'),
|
||||
('cms', '0014_auto_20160404_1908'),
|
||||
('ungleich_page', '0015_ungleichsimpleheader'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='UngleichHeaderWithBackgroundImageSlider',
|
||||
fields=[
|
||||
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
|
||||
('carousel_data_interval', models.IntegerField(default=2000)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('cms.cmsplugin',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='UngleichHeaderWithBackgroundImageSliderItem',
|
||||
fields=[
|
||||
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
|
||||
('description', djangocms_text_ckeditor.fields.HTMLField(default='<div class="intro-cap">We Design, Configure & Maintain <br>Your Linux Infrastructure</div><p class="intro_lead">Ruby on Rails, Django, Java, Webserver, Mailserver, any infrastructure that needs to configured, we provide comprehensive solutions. Amazon, rackspace or bare metal servers, we configure for you.</p><p style="text-align: right;"><a class="btn btn-trans" href="">Learn More</a></p>')),
|
||||
('background_image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ungleich_header_slider_item_image', to='filer.Image')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=('cms.cmsplugin',),
|
||||
),
|
||||
]
|
|
@ -124,6 +124,27 @@ class UngleichHeader(CMSPlugin):
|
|||
carousel_data_interval = models.IntegerField(default=5000)
|
||||
|
||||
|
||||
class UngleichHeaderWithBackgroundImageSliderItem(CMSPlugin):
|
||||
background_image = FilerImageField(
|
||||
null=True, blank=True,
|
||||
related_name="ungleich_header_slider_item_image",
|
||||
on_delete=models.SET_NULL
|
||||
)
|
||||
description = HTMLField(
|
||||
default='<div class="intro-cap">We Design, Configure & Maintain '
|
||||
'<br>Your Linux Infrastructure</div><p class="intro_lead">'
|
||||
'Ruby on Rails, Django, Java, Webserver, Mailserver, any '
|
||||
'infrastructure that needs to configured, we provide '
|
||||
'comprehensive solutions. Amazon, rackspace or bare metal '
|
||||
'servers, we configure for you.</p><p style="text-align: '
|
||||
'right;"><a class="btn btn-trans" href="">Learn More</a></p>'
|
||||
)
|
||||
|
||||
|
||||
class UngleichHeaderWithBackgroundImageSlider(CMSPlugin):
|
||||
carousel_data_interval = models.IntegerField(default=2000)
|
||||
|
||||
|
||||
class UngleichHeaderItem(CMSPlugin):
|
||||
image = FilerImageField(
|
||||
null=True,
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<div class="bg_img" style="background-image:url({{ instance.background_image.url }})"></div>
|
||||
<div class="container">
|
||||
{{ instance.description }}
|
||||
</div>
|
|
@ -0,0 +1,31 @@
|
|||
{% load cms_tags %}
|
||||
<header class="header_slider">
|
||||
<div id="carousel-header-ungleich" class="carousel slide" data-interval="{{ instance.carousel_data_interval}}">
|
||||
<!-- Indicators -->
|
||||
{% if instance.child_plugin_instances|length > 1 %}
|
||||
<ol class="carousel-indicators">
|
||||
{% for plugin in instance.child_plugin_instances %}
|
||||
<li data-target="#carousel-header-ungleich" data-slide-to="{{forloop.counter0}}" {% if forloop.counter0 == 0 %}class="active" {% endif %}></li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
<!-- Wrapper for slides -->
|
||||
<div class="carousel-inner" role="listbox">
|
||||
{% for plugin in instance.child_plugin_instances %}
|
||||
<div class="item {% if forloop.counter0 == 0 %}active{% endif %}">
|
||||
{% render_plugin plugin %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if instance.child_plugin_instances|length > 1 %}
|
||||
<a class="left carousel-control" href="#carousel-header-ungleich" role="button" data-slide="prev">
|
||||
<span class="fa fa-angle-left" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="right carousel-control" href="#carousel-header-ungleich" role="button" data-slide="next">
|
||||
<span class="fa fa-angle-right" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
Loading…
Reference in a new issue