Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Adds Jumbotron Component #126

Merged
merged 1 commit into from
Jan 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions aldryn_bootstrap3/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,35 @@ def icon_src(self, instance):
return static('aldryn_bootstrap3/img/type/label.png')


class Bootstrap3JumbotronCMSPlugin(CMSPluginBase):
"""
Component - Jumbotron: Plugin
http://getbootstrap.com/components/#jumbotron
"""
model = models.Boostrap3JumbotronPlugin
name = _('Jumbotron')
module = _('Bootstrap 3')
change_form_template = 'admin/aldryn_bootstrap3/base.html'
render_template = 'aldryn_bootstrap3/plugins/jumbotron.html'
allow_children = True

fieldsets = (
(None, {
'fields': (
'label',
'grid',
)
}),
(_('Advanced settings'), {
'classes': ('collapse',),
'fields': (
'classes',
'attributes',
),
}),
)


class Bootstrap3AlertCMSPlugin(CMSPluginBase):
"""
Component - Alert: Plugin
Expand Down Expand Up @@ -1075,6 +1104,7 @@ def icon_src(self, instance):
plugin_pool.register_plugin(Bootstrap3ResponsiveCMSPlugin)
plugin_pool.register_plugin(Bootstrap3IconCMSPlugin)
plugin_pool.register_plugin(Bootstrap3LabelCMSPlugin)
plugin_pool.register_plugin(Bootstrap3JumbotronCMSPlugin)
plugin_pool.register_plugin(Bootstrap3AlertCMSPlugin)
plugin_pool.register_plugin(Bootstrap3ListGroupCMSPlugin)
plugin_pool.register_plugin(Bootstrap3ListGroupItemCMSPlugin)
Expand Down
31 changes: 31 additions & 0 deletions aldryn_bootstrap3/migrations/0013_boostrap3jumbotronplugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import aldryn_bootstrap3.model_fields
import djangocms_attributes_field.fields


class Migration(migrations.Migration):

dependencies = [
('cms', '0016_auto_20160608_1535'),
('aldryn_bootstrap3', '0012_bootstrap3tabplugin'),
]

operations = [
migrations.CreateModel(
name='Boostrap3JumbotronPlugin',
fields=[
('label', models.CharField(max_length=255, verbose_name='Label', blank=True)),
('grid', models.BooleanField(default=False, help_text='Adds a "container" element inside of the "Jumbotron"for use outside of a grid.', verbose_name='Add container')),
('classes', aldryn_bootstrap3.model_fields.Classes(default='', help_text='Space separated classes that are added to the class. See <a href="http://getbootstrap.com/css/" target="_blank">Bootstrap 3 documentation</a>.', verbose_name='Classes', blank=True)),
('attributes', djangocms_attributes_field.fields.AttributesField(default=dict, verbose_name='Attributes', blank=True)),
('cmsplugin_ptr', models.OneToOneField(parent_link=True, related_name='aldryn_bootstrap3_boostrap3jumbotronplugin', primary_key=True, serialize=False, to='cms.CMSPlugin')),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]
47 changes: 39 additions & 8 deletions aldryn_bootstrap3/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ def __str__(self):
# [ ] Button Groups
# [ ] Button Dropdowns
# [✓] Input Groups (via aldryn-forms)
# [✗] Navs (integrate into base.html)
# [✗] Navbar (integrate into base.html)
# [✗] Breadcrumbs (integrate into base.html)
# [✗] Pagination (integrate on addon level)
# [✗] Navs (not applicable)
# [✗] Navbar (not applicable)
# [✗] Breadcrumbs (not applicable)
# [✗] Pagination (not applicable)
# [✓] Labels
# [✗] Badges (integrate on addon level)
# [ ] Jumbotron
# [] Page header (integrate into base.html)
# [✗] Badges (not applicable)
# [] Jumbotron
# [ ] Page header
# [ ] Thumbnails
# [✓] Alerts
# [ ] Progress Bars
Expand Down Expand Up @@ -557,6 +557,37 @@ def __str__(self):
return self.label


@python_2_unicode_compatible
class Boostrap3JumbotronPlugin(CMSPlugin):
"""
Component - Jumbotron: Model
http://getbootstrap.com/components/#jumbotron
"""
label = models.CharField(
verbose_name=_('Label'),
blank=True,
max_length=255,
)
grid = models.BooleanField(
verbose_name=('Add container'),
default=False,
blank=True,
help_text=_('Adds a "container" element inside of the "Jumbotron"'
'for use outside of a grid.'),
)
classes = model_fields.Classes()
attributes = AttributesField(
verbose_name=_('Attributes'),
blank=True,
excluded_keys=['class'],
)

cmsplugin_ptr = model_fields.CMSPluginField()

def __str__(self):
return self.label or str(self.pk)


@python_2_unicode_compatible
class Boostrap3AlertPlugin(CMSPlugin):
"""
Expand Down Expand Up @@ -777,7 +808,7 @@ def __str__(self):
#
# The following components marked with "✓" are implemented:
#
# [x] Transitions (integrate into your site)
# [x] Transitions (not applicable)
# [ ] Modal
# [ ] Dropdowns
# [ ] Scrollspy
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% load cms_tags %}

<div class="jumbotron
{% if instance.classes %} {{ instance.classes }}{% endif %}"
{{ instance.attributes_str }}>
{% if instance.grid %}<div class="container">{% endif %}
{% for plugin in instance.child_plugin_instances %}
{% render_plugin plugin %}
{% endfor %}
{% if instance.grid %}</div>{% endif %}
</div>