Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar #58

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
bb7f88c
Update buttons.py
haricot Jul 3, 2019
85a64d1
add plugins bootstrap navbar
haricot Jul 4, 2019
bf4d99b
add navbarplugin.js
haricot Jul 4, 2019
4b2cf0e
add conditional required image plug
haricot Jul 4, 2019
c837d26
update settings.py
haricot Jul 4, 2019
667a8ec
add js logic for placeholder
haricot Jul 4, 2019
e953cbc
add templates bootstrap Navbar
haricot Jul 4, 2019
59f0102
add mixins bootstrap
haricot Jul 4, 2019
080441f
update bootstrap4/settings.py
haricot Jul 4, 2019
79dc8a8
update bootstrap4/navbar_brand_image.html
haricot Jul 4, 2019
9255bc5
update bootstrap4/navbar.py
haricot Jul 4, 2019
79aec8c
if button in navbar add css class
haricot Jul 5, 2019
61195f7
fix choices in BootstrapUtilities
haricot Jul 5, 2019
6e988d6
Update navbar plugins
haricot Jul 5, 2019
75d4c8e
if simple icon in NavItem add css class
haricot Jul 5, 2019
e66d914
Correct logic if not check_unique_element_id
haricot Jul 5, 2019
c3605a3
modify logic if image and required
haricot Jul 5, 2019
2d2c4c2
if link in navItem add css class
haricot Jul 5, 2019
38c3059
update buttons.py
haricot Jul 6, 2019
e5cd29f
add classes if parent match
haricot Sep 4, 2019
32a6a66
add classes if specific parent match
haricot Sep 4, 2019
13760c8
Update BootstrapNavbarPlugin
haricot Sep 4, 2019
aed9b67
add bootstrap4 mixins: positions
haricot Sep 4, 2019
ce6ad20
update bootstrap4/settings.py
haricot Sep 4, 2019
ce4476c
add BootstrapListsPlugin
haricot Sep 4, 2019
c2a6d7f
Merge branch 'releases/1.0.x' into navbar
haricot Sep 4, 2019
98674af
Update image.py
haricot Oct 14, 2019
02d6e7e
Merge pull request #14 from jrief/master
haricot Oct 14, 2019
ea85d10
fix unneeded import error
haricot Oct 14, 2019
eab4c2e
add pyproject.toml
haricot Oct 14, 2019
c58faa2
Update pyproject.toml
haricot Oct 14, 2019
59f8ab1
Update settings.py
haricot Oct 14, 2019
10658db
Update cms_plugins.py
haricot Oct 17, 2019
8af7f4a
Update cms_plugins.py
haricot Oct 17, 2019
b291f3d
Update cms_plugins.py
haricot Oct 17, 2019
7bf489c
fix stride
haricot Oct 17, 2019
d0885ac
Update navbar.py
haricot Oct 17, 2019
08e036e
Update cms_plugins.py
haricot Oct 17, 2019
703eca1
Update cms_plugins.py
haricot Oct 17, 2019
2ea45fa
fix missing icon in setting bootstrap/test strides
haricot Oct 21, 2019
52d3aa2
accelerate test travis
haricot Oct 21, 2019
9ba03e2
Merge branch 'master' into navbar
haricot Oct 21, 2019
f25414b
Update navbar.py
haricot Oct 21, 2019
adbae56
logic inject classes if button in navbar
haricot Oct 21, 2019
0aa84c4
Update settings.py
haricot Oct 21, 2019
bc47f9d
add Jumbotron logic if 'fixed-top' and navbar and toolbar edit
haricot Oct 23, 2019
9abe99b
Update navbar.html
haricot Oct 23, 2019
6bd2318
clean code Navbar Plugins
haricot Oct 23, 2019
f74c3c3
Update settings.py
haricot Oct 23, 2019
473814a
SimpleIcon: add content for easy add icon and text link
haricot Oct 23, 2019
b78db04
Update simpleicon.html: add content
haricot Oct 23, 2019
c37bf8f
fixed: test SimpleIconPlugin
haricot Oct 24, 2019
5c80447
fixed: test SimpleIconPlugin
haricot Oct 24, 2019
57ea867
Create bootstrap-navbar.json
haricot Oct 27, 2019
eb3ee0f
Update test_strides.py
haricot Oct 27, 2019
f889bdd
Update jumbotron.html
haricot Oct 27, 2019
4efaf0d
Update picture.py
haricot Oct 27, 2019
a1958d0
remove unneeded bootstrap_tags for navbar
haricot Oct 27, 2019
26b9c55
remove unneeded bootstrap_tags for nav collapse
haricot Oct 27, 2019
942304e
Rename bootstrap-navbar.json to bootstrap-jumbotron-navbar.json
haricot Oct 28, 2019
e737624
Create bootstrap-navbar.json
haricot Oct 28, 2019
de3f5c0
Update test_base.py
haricot Oct 28, 2019
5830082
Update test_strides.py
haricot Oct 28, 2019
4dbf2df
Update test_strides.py
haricot Oct 28, 2019
f4caa43
Update test_strides.py
haricot Oct 28, 2019
fc6c572
Update navbar.html
haricot Oct 28, 2019
ef1f8ba
Update navbar_collapse.html
haricot Oct 28, 2019
69d5cd7
Update navbar.py
haricot Oct 28, 2019
e95f3fd
Update navbar.py
haricot Oct 28, 2019
05613a5
Update navbar.py
haricot Oct 28, 2019
fe027bc
Update test_strides.py
haricot Oct 28, 2019
16e379a
Fix strides pass
haricot Oct 28, 2019
b446106
Update navbar.py
haricot Oct 28, 2019
b4420c2
fix stride pass
haricot Oct 28, 2019
27372fb
fixed stride pass
haricot Oct 28, 2019
17722a4
Update navbar_nav_items_li_menu_main_links.html
haricot Oct 28, 2019
1bb5fbf
Delete navbar_nav_list.html
haricot Oct 28, 2019
8d535c6
Delete navbar_nav_item.html
haricot Oct 28, 2019
d2374f9
Delete navbar_nav_link.html
haricot Oct 28, 2019
a1b9448
Delete navbar_nav_items_links.html
haricot Oct 28, 2019
4fad53c
Update cms_plugins.py
haricot Oct 28, 2019
c6d3249
Update bootstrap-navbar.json
haricot Oct 28, 2019
a54b88b
fixed stride pass
haricot Oct 28, 2019
59d3727
add 'cms_bootstrap' in test/settings.py
haricot Oct 28, 2019
0ecf83f
Update test_base.py
haricot Oct 28, 2019
32c25a1
Update test_base.py
haricot Oct 28, 2019
afeb76d
Update test_strides.py
haricot Oct 28, 2019
1015aa4
Update test_strides.py
haricot Oct 28, 2019
9793487
Update bootstrap-navbar.json
haricot Oct 28, 2019
f811fe1
Update navbar.py
haricot Oct 28, 2019
d73426f
Merge branch 'master' into navbar
haricot Nov 4, 2019
26c650d
Merge branch 'master' into navbar
haricot Jan 9, 2020
a8a1903
wip navbar
haricot Jan 11, 2020
143aef4
fix wip navbar
haricot Jan 11, 2020
32c7303
travis test
haricot Jan 11, 2020
a6ed567
wip navbar test
haricot Jan 11, 2020
d556eb8
Merge pull request #25 from jrief/master
haricot Jan 13, 2020
b2e1a52
clean code
haricot Jan 13, 2020
01236b8
Update .travis.yml
haricot Jan 13, 2020
53b95f3
clean code
haricot Jan 13, 2020
9951ba2
clean code
haricot Jan 13, 2020
1542447
wip navbar
haricot Jan 13, 2020
765fcda
fix wip navbar test
haricot Jan 13, 2020
95d4018
Merge pull request #26 from haricot/patch-50
haricot Jan 13, 2020
21ebb44
add js/vanilla func:placeholder_position_top(title)
haricot Mar 12, 2020
2cb1b13
add BootstrapNavBarPlugin support angular-ui
haricot Mar 13, 2020
5ac027b
add BootstrapNavBarPlugin support angular-ui
haricot Mar 13, 2020
34cb07d
add BootstrapListsSeparatorPlugin <li class="w-100"></li>
haricot Mar 14, 2020
f7d8fc1
Create navbar_list_separator.html
haricot Mar 14, 2020
4aa0c8a
fix merge
haricot Oct 28, 2020
8e763fa
fix lists.py:import order
haricot Oct 28, 2020
76cd22e
fix navbar.py: import order
haricot Oct 28, 2020
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
5 changes: 4 additions & 1 deletion cmsplugin_cascade/bootstrap4/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Meta:

class BootstrapButtonMixin(IconPluginMixin):
require_parent = True
parent_classes = ['BootstrapColumnPlugin', 'SimpleWrapperPlugin']
parent_classes = ['BootstrapColumnPlugin', 'SimpleWrapperPlugin','BootstrapNavItemsPlugin', 'BootstrapListsPlugin']
render_template = 'cascade/bootstrap4/button.html'
allow_children = False
default_css_class = 'btn'
Expand Down Expand Up @@ -167,6 +167,9 @@ def get_css_classes(cls, obj):
css_classes = cls.super(BootstrapButtonPlugin, cls).get_css_classes(obj)
if obj.glossary.get('stretched_link'):
css_classes.append('stretched_link')
if hasattr(obj, 'parent') and hasattr(obj.parent,'parent') and hasattr(obj.parent.parent,'plugin_type'):
if obj.parent.parent.plugin_type == 'BootstrapNavBrandPlugin':
css_classes.insert(0,'nav-link text-left')
return css_classes

@classmethod
Expand Down
70 changes: 70 additions & 0 deletions cmsplugin_cascade/bootstrap4/lists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import ChoiceField
from .plugin_base import BootstrapPluginBase
from cms.plugin_pool import plugin_pool
from entangled.forms import EntangledModelFormMixin

import logging
logger = logging.getLogger('cascade')

class BootstrapListsMixin( EntangledModelFormMixin):
list_options = ChoiceField(
label=_("List Options"),
choices=[
('inherit', _("inherit")),
('inline-item', _('ul(class="inline-item").li(class="list-inline-item")')),
('navbar-nav', _('ul(class="navbar-nav").li(class="nav-item")')),
],
required=False,
)
class Meta:
entangled_fields = {'glossary': ['list_options']}


@plugin_pool.register_plugin
class BootstrapListsPlugin(BootstrapPluginBase):
name = _("Lists")
alien_plugins = True
form = BootstrapListsMixin
alien_child_classes = True
render_template = 'cascade/bootstrap4/navbar_list.html'
default_css_class = ''
require_parent = False

@classmethod
def get_css_classes(cls, obj):
css_classes = cls.super(BootstrapListsPlugin, cls).get_css_classes(obj)
list_options = [obj.glossary.get('list_options')] if obj.glossary.get('list_options') else ''
if list_options:
for opts in list_options:
css_classes.append(opts)
return css_classes


@classmethod
def get_identifier(cls, obj):
identifier = super(BootstrapListsPlugin, cls).get_identifier(obj)
if hasattr(cls,'default_css_class'):
css_classes_without_default = obj.css_classes.replace( cls.default_css_class , '' , 1)
else:
css_classes_without_default = obj.css_classes
return format_html('<div style="font-size: smaller; white-space: pre-wrap;" >{0}{1}</div>',
identifier, css_classes_without_default )

@classmethod
def sanitize_model(cls, obj):
list_child_css_classes = obj.glossary['child_css_classes'].split(' ') if 'child_css_classes' in obj.glossary else []
list_options = 'list-inline-item' if obj.glossary.get('list_options') else ''
list_options = 'nav-item' if obj.glossary.get('list_options') == 'navbar-nav' else list_options
if list_options:
list_child_css_classes.append(list_options)
obj.glossary['child_css_classes'] = ' '.join(list_child_css_classes)
super().sanitize_model(obj)

@plugin_pool.register_plugin
class BootstrapListsSeparatorPlugin(BootstrapPluginBase):
name = _("Li Separator")
require_parent = True
parent_classes = ['BootstrapListsPlugin']
render_template = 'cascade/bootstrap4/navbar_list_separator.html'
101 changes: 101 additions & 0 deletions cmsplugin_cascade/bootstrap4/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,104 @@ def floats(cls):
initial='',
)
return form_fields

@property
def flex_directions(cls):
form_fields = {}
choices_format = [
('flex-{}row', _("horizontal")),
('flex-{}row-reverse', _("horizontal reverse")),
('flex-{}column', _("Vertical")),
('flex-{}column-reverse', _("Vertical reverse")),
]
for bp in Breakpoint.range(Breakpoint.xs, Breakpoint.xl):
if bp == Breakpoint.xs:
choices = [ (c.format(''), l ) for c, l in choices_format]
choices.insert(0, ('', _("No Flex Directions")))
else:
choices = [(c.format(bp.name + '-'), l) for c, l in choices_format]
choices.insert(0, ('', _("Inherit from above")))
form_fields['Flex_{}'.format(bp.name)] = ChoiceField(
label=format_lazy(_("Flex Directions for {breakpoint}"), breakpoint=bp.label),
choices=choices,
required=False,
initial=''
)
return form_fields

@property
def display_propertys(cls):
form_fields = {}
choices_format = [
('d-{}{}', _("horizontal")),
]
notation = ['none', 'inline', 'inline-block', 'block', 'table', 'table-cell', 'table-row', 'flex', 'inline-flex']
for bp in Breakpoint.range(Breakpoint.xs, Breakpoint.xl):
if bp == Breakpoint.xs:
choices = [(c.format('', n), c.format('', n)) for c, l in choices_format for n in notation]
choices.insert(0, ('', _("No Display Propertys")))
else:
choices = [(c.format(bp.name + '-', n), c.format(bp.name + '-', n)) for c, l in choices_format for n in notation]
choices.insert(0, ('', _("Inherit from above")))
form_fields['Flex_{}'.format(bp.name)] = ChoiceField(
label=format_lazy(_("Flex Directions for {breakpoint}"), breakpoint=bp.label),
choices=choices,
required=False,
initial=''
)
return form_fields

@property
def justify_content(cls):
form_fields = {}
choices_format = [
('justify-content-{}{}', _("Justify Content")),
]
notation = [ 'start', 'end', 'center', 'between', 'around']
for bp in Breakpoint.range(Breakpoint.xs, Breakpoint.xl):
if bp == Breakpoint.xs:
choices = [(c.format('', n), c.format('', n)) for c, l in choices_format for n in notation]
choices.insert(0, ('', _("No Justify content")))
else:
choices = [(c.format(bp.name + '-', n),
c.format(bp.name + '-', n)) for c, l in choices_format for n in notation]
choices.insert(0, ('', _("Inherit from above")))
form_fields['Justify_content_{}'.format(bp.name)] = ChoiceField(
label=format_lazy(_("Justify Content for {breakpoint}"), breakpoint=bp.label),
choices=choices,
required=False,
initial=''
)
return form_fields

@property
def positions(cls):
form_fields = {}
choices_format = [
('{}', _("Position")),
]
notation = ['inherit', 'fixed-top' , 'fixed-bottom' , 'sticky-top']
choices = [ (str(n), str(n)) for c, l in choices_format for n in notation]
form_fields['Position'] = ChoiceField(
label=format_lazy(_("Position")),
choices=choices,
required=False,
initial=''
)
return form_fields

@property
def list_inline(cls):
form_fields = {}
choices_format = [
('{}', _("List inline")),
]
notation = ['inherit', 'fixed-top' , 'fixed-bottom' , 'sticky-top']
choices = [ (str(n), str(n)) for c, l in choices_format for n in notation]
form_fields['Position'] = ChoiceField(
label=format_lazy(_("Position")),
choices=choices,
required=False,
initial=''
)
return form_fields
Loading