Add UngleichHeaderWithTextAndImagePlugin

This commit is contained in:
PCoder 2017-11-24 20:29:26 +01:00
parent 7b662e9b88
commit 824fd1a6b5
4 changed files with 77 additions and 1 deletions

View file

@ -5,7 +5,7 @@ from .models import (
UngelichContactUsSection, UngelichTextSection, Service, ServiceItem,
About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader,
UngleichHeaderItem, UngleichProductItem, UngleichProduct, UngleichCustomer,
UngleichCustomerItem, UngleichHTMLOnly
UngleichCustomerItem, UngleichHTMLOnly, UngleichSimpleHeader
)
@ -181,6 +181,18 @@ class UngleichServicesItemPlugin(CMSPluginBase):
return context
@plugin_pool.register_plugin
class UngleichHeaderWithTextAndImagePlugin(CMSPluginBase):
name = "ungleich Header with Text and Image Plugin"
model = UngleichSimpleHeader
render_template = "ungleich_page/ungleich/header.html"
cache = False
def render(self, context, instance, placeholder):
context['instance'] = instance
return context
@plugin_pool.register_plugin
class UngleichHeaderWithTextAndImageSliderPlugin(CMSPluginBase):
name = "ungleich Header with Text and Image Slider Plugin"

View file

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-11-24 19:12
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', '0014_ungleichhtmlonly_name'),
]
operations = [
migrations.CreateModel(
name='UngleichSimpleHeader',
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')),
('text', djangocms_text_ckeditor.fields.HTMLField()),
('background_image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ungleich_simple_header_background_image', to='filer.Image')),
('image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ungleich_simple_header_image', to='filer.Image')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View file

@ -98,6 +98,22 @@ class UngleichServiceItem(ServiceItem):
)
class UngleichSimpleHeader(CMSPlugin):
background_image = FilerImageField(
null=True,
blank=True,
related_name="ungleich_simple_header_background_image",
on_delete=models.SET_NULL
)
image = FilerImageField(
null=True,
blank=True,
related_name="ungleich_simple_header_image",
on_delete=models.SET_NULL
)
text = HTMLField()
class UngleichHeader(CMSPlugin):
background_image = FilerImageField(
null=True,

View file

@ -0,0 +1,15 @@
{% load cms_tags %}
<!-- Header -->
<header style="background-image: url({{ instance.background_image.url }})">
<div class="container">
<div class="intro-text">
<img src="{{ instance.image.url }}" alt="" class="logo-image" img-responsive="" width="300" />
<p></p><p></p><br>
<div class="intro-cap">
<span class="intro-cap">
{{ instance.text }}
</span>
</div>
</div>
</div>
</header>