Merge pull request #567 from tiwariav/task/4105/cms_ungleich_footer_plugin

task/4105 cms footer plugin
This commit is contained in:
Pcoder 2018-02-21 11:12:02 +01:00 committed by GitHub
commit d48f27711c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 161 additions and 1 deletions

View file

@ -8,6 +8,7 @@ from .models import (
UngleichCustomerItem, UngleichHTMLOnly, UngleichCustomerItem, UngleichHTMLOnly,
UngleichHeaderWithBackgroundImageSlider, UngleichHeaderWithBackgroundImageSlider,
UngleichHeaderWithBackgroundVideoSliderItem, UngleichHeaderWithBackgroundVideoSliderItem,
UngleichFooter
) )
@ -295,3 +296,18 @@ class UngleichHTMLPlugin(CMSPluginBase):
) )
context['instance'] = instance context['instance'] = instance
return context return context
@plugin_pool.register_plugin
class UngleichFooterPlugin(CMSPluginBase):
name = "ungleich Footer Plugin"
model = UngleichFooter
render_template = "ungleich_page/ungleich/_footer.html"
cache = False
def render(self, context, instance, placeholder):
context = super(UngleichFooterPlugin, self).render(
context, instance, placeholder
)
context['instance'] = instance
return context

View file

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-02-08 15:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ungleich_page', '0017_auto_20171219_1856'),
('cms', '0014_auto_20160404_1908'),
]
operations = [
migrations.CreateModel(
name='UngleichFooter',
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')),
('copyright_label', models.CharField(blank=True, default='',
help_text='Name of the company alongside the copyright year', max_length=100)),
('link_text', models.CharField(
blank=True, help_text='Text for the link on the right part of footer', max_length=100, null=True)),
('link_url', models.URLField(blank=True,
help_text='Url to the link in footer', null=True)),
('twitter_url', models.URLField(
blank=True, help_text='If empty, twitter btn will not be visible', null=True)),
('linkedin_url', models.URLField(
blank=True, help_text='If empty, linkedin btn will not be visible', null=True)),
('github_url', models.URLField(
blank=True, help_text='If empty, github btn will not be visible', null=True)),
('facebook_url', models.URLField(
blank=True, help_text='If empty, facebook btn will not be visible', null=True)),
('youtube_url', models.URLField(
blank=True, help_text='If empty, youtube btn will not be visible', null=True)),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]

View file

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2018-02-08 20:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ungleich_page', '0018_ungleichfooter'),
('ungleich_page', '0018_auto_20180105_1826'),
]
operations = [
]

View file

@ -169,3 +169,38 @@ class UngleichHTMLOnly(CMSPlugin):
def __str__(self): def __str__(self):
return self.name return self.name
class UngleichFooter(CMSPlugin):
copyright_label = models.CharField(
max_length=100, default='', blank=True,
help_text='Name of the company alongside the copyright year'
)
link_text = models.CharField(
max_length=100, blank=True, null=True,
help_text='Text for the link on the right part of footer'
)
link_url = models.URLField(
blank=True, null=True,
help_text='Url to the link in footer'
)
twitter_url = models.URLField(
blank=True, null=True,
help_text='If empty, twitter btn will not be visible'
)
linkedin_url = models.URLField(
blank=True, null=True,
help_text='If empty, linkedin btn will not be visible'
)
github_url = models.URLField(
blank=True, null=True,
help_text='If empty, github btn will not be visible'
)
facebook_url = models.URLField(
blank=True, null=True,
help_text='If empty, facebook btn will not be visible'
)
youtube_url = models.URLField(
blank=True, null=True,
help_text='If empty, youtube btn will not be visible'
)

View file

@ -0,0 +1,47 @@
<footer>
<div class="container">
<div class="row">
<div class="col-md-4">
<span class="copyright">Copyright © {{instance.copyright_label}} {% now "Y" %}</span>
</div>
<div class="col-md-4">
<ul class="list-inline social-buttons">
{% if instance.twitter_url %}
<li>
<a href="{{instance.twitter_url}}"><i class="fa fa-twitter"></i></a>
</li>
{% endif %}
{% if instance.github_url %}
<li>
<a href="{{instance.github_url}}"><i class="fa fa-github"></i></a>
</li>
{% endif %}
{% if instance.linkedin_url %}
<li>
<a href="{{instance.linkedin_url}}"><i class="fa fa-linkedin"></i></a>
</li>
{% endif %}
{% if instance.facebook_url %}
<li>
<a href="{{instance.facebook_url}}"><i class="fa fa-facebook"></i></a>
</li>
{% endif %}
{% if instance.youtube_url %}
<li>
<a href="{{instance.youtube_url}}"><i class="fa fa-youtube-play"></i></a>
</li>
{% endif %}
</ul>
</div>
<div class="col-md-4">
{% if instance.link_text %}
<ul class="list-inline quicklinks">
<li>
<a href="{{instance.link_url}}">{{instance.link_text}}</a>
</li>
</ul>
{% endif %}
</div>
</div>
</div>
</footer>

View file

@ -41,7 +41,9 @@
{% placeholder 'Ungleich Page Contents' %} {% placeholder 'Ungleich Page Contents' %}
<!-- Footer --> <!-- Footer -->
{% placeholder 'Footer' or %}
{% include "ungleich_page/includes/_footer.html" %} {% include "ungleich_page/includes/_footer.html" %}
{% endplaceholder %}
<!-- jQuery --> <!-- jQuery -->
<script src="{% static 'ungleich_page/js/jquery.js' %}" type="text/javascript"></script> <script src="{% static 'ungleich_page/js/jquery.js' %}" type="text/javascript"></script>