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

Adding optional discard defaults by variable merge_extra_fields #347

Closed
wants to merge 249 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
249 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
fbeddec
fixed discard defaults
haricot Oct 9, 2019
af2e0e5
adding optional discard defaults by variable
haricot Oct 9, 2019
59e58bc
use RadioSelect for ExtraFieldsPluginFormMixin
haricot Oct 10, 2019
134a9c2
unneeded import
haricot Oct 10, 2019
a404eb4
clean syntax
haricot Oct 11, 2019
f33d5f8
adding bootstrap_tabset in conftest.py
haricot Oct 11, 2019
6125a7d
fix importt tabs instead of tab
haricot Oct 11, 2019
f078834
add blank link extrafields setting in form plugin
haricot Oct 14, 2019
82033af
variable MERGE_EXTRA_FIEDLS to merge_extra_fields
haricot Oct 14, 2019
769173b
replace MERGE_EXTRA_FIELDS_SET/merge_extra_fields
haricot Oct 14, 2019
809beaf
Update customize-styles.rst
haricot Oct 14, 2019
23af840
Update customize-styles.rst
haricot Oct 14, 2019
4c587f2
Update customize-styles.rst
haricot Oct 14, 2019
2eba0ce
remove BootstrapTabSetPlugin test
haricot Oct 14, 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
cd086a7
Update mixins.py
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
0555281
CascadeUtilitiesMixin for css_class and hml_attrs
haricot Dec 16, 2019
dd560df
BootstrapUtilities can use css_class and hml_attrs
haricot Dec 16, 2019
0057fa5
move HtmlAttrsUtilities for prevent issue import lazy cascadepage
haricot Dec 16, 2019
4fbb23c
bs4demo add required for scroll animate
haricot Dec 16, 2019
30ab4b4
prevent no element cascadepage
haricot Dec 16, 2019
82be698
HtmlAttrsUtilities => GenericUtilities
haricot Dec 16, 2019
e81811b
Add refresh plugin when edit plugin with sal
haricot Dec 16, 2019
e3c98bb
add Helpers: fieldset_by_widget_attr()
haricot Dec 19, 2019
27da901
add widgets: attr key_group / template_name
haricot Dec 19, 2019
e73d86e
add widgets: attr key_group / template_name
haricot Dec 19, 2019
0c94753
add config cascade test
haricot Dec 19, 2019
4e7119d
plugin_base:add reshapping fieldset
haricot Dec 19, 2019
e639489
fix import
haricot Dec 19, 2019
5920c7e
fix import SelectIconWidget
haricot Dec 19, 2019
721eaec
fix wip
haricot Dec 19, 2019
a46fe5c
.gitingore >> .venv/ poetry.lock
haricot Dec 19, 2019
a30addf
refactor wip
haricot Dec 20, 2019
afca157
wip refactor
haricot Dec 20, 2019
b0a9111
Merge pull request #24 from jrief/master
haricot Dec 20, 2019
3a45723
wip COMPACT_FORM with contional envrion
haricot Dec 20, 2019
539d061
add helpers used_compact_form
haricot Dec 20, 2019
ad0d006
wip used_compact_form conditional
haricot Dec 20, 2019
677dff1
wip used_compact_form
haricot Dec 20, 2019
ce40193
wip used_compact_form
haricot Dec 20, 2019
c5ed6e8
wip used_compact_form
haricot Dec 20, 2019
f207318
wip ui fusion double margins,paddings
haricot Dec 20, 2019
0c52a18
used_compact_form with env COMPACT_FORM
haricot Dec 21, 2019
76e32cc
wip entangled_nested
haricot Dec 21, 2019
dd704ef
wip entangled_nested
haricot Dec 21, 2019
a748e3f
first fonctional wip compact form
haricot Jan 5, 2020
a73b54c
wip compact form
haricot Jan 5, 2020
541f211
wip optimize css
haricot Jan 7, 2020
7a51530
wip optimize
haricot Jan 8, 2020
6a71663
wip optimize
haricot Jan 8, 2020
d7f34cd
clean code
haricot Jan 8, 2020
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
8e3387a
fix ColorField initial inherit_color is not True by default
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
1804fa2
import/export for placeholder in structure view
jrief Feb 5, 2020
e7809d9
configure editor for css files
jrief Feb 5, 2020
b9af019
return to static default dict
jrief Feb 5, 2020
01605b4
allow to use phone numbers in links
jrief Feb 5, 2020
558d969
what has changed
jrief Feb 5, 2020
1d8d94d
fix: Pasting of invalid trees via clipboard raises exception
jrief Feb 10, 2020
e92f320
wip clipboard_group
haricot Feb 18, 2020
d3c2f2d
remove not needed code
haricot Feb 18, 2020
82cc88e
wip clipboard_group (optimize, clean code)
haricot Feb 18, 2020
8372d4f
wip clipboard_group (add model ManyToManyField)
haricot Feb 18, 2020
d8d1543
wip clipboard_group (add migrations)
haricot Feb 18, 2020
8027e99
wip clipboard_group (admin group)
haricot Feb 18, 2020
22d87a4
wip clipboard_group (finished)
haricot Feb 18, 2020
6e5ebb0
wip view_groups clipboard
haricot Feb 22, 2020
911ef9d
wip view_groups clipboard
haricot Feb 22, 2020
5c1c9bf
wip view_groups clipboard
haricot Feb 22, 2020
e7e6d6b
wip view_groups clipboard
haricot Feb 22, 2020
f69c58b
update migrations
haricot Feb 22, 2020
3f1cddd
wip view_group clipboard
haricot Feb 22, 2020
be5f98c
fix py35 test
haricot Feb 22, 2020
6170748
wip groups clipboard
haricot Feb 22, 2020
a85252b
wip groups clipboard
haricot Feb 22, 2020
25a3855
remove unneeded file
haricot Feb 22, 2020
6950f08
fix stride test required
haricot Feb 22, 2020
4921bb6
wip groups clipboard
haricot Feb 22, 2020
d67f68f
wip groups clipboard (fix test)
haricot Feb 22, 2020
1675e1d
wip groups clipboard (fix test)
haricot Feb 22, 2020
98c693f
wip groups clipboard (fix test)
haricot Feb 22, 2020
115b8c0
wip groups clipboard (fix .json data)
haricot Feb 23, 2020
46b74ce
wip groups clipboard (fix test)
haricot Feb 23, 2020
082ac0f
wip clipboards group and fallback
haricot Feb 23, 2020
9e2acb4
fix image fallback
haricot Feb 23, 2020
1c0d49c
wip fallback clipboards group
haricot Feb 24, 2020
76e8a02
wip fallback clipboards group
haricot Feb 24, 2020
3cd8092
wip fallback clipboards group
haricot Feb 24, 2020
265be16
wip fallback clipboards group (clean code)
haricot Feb 24, 2020
462f010
readd accurate fallback
haricot Feb 24, 2020
7b30db0
fix picture edit bs4demo/settings.py
haricot Feb 24, 2020
b797c4c
wip clipboard import
haricot Feb 27, 2020
ce5dd10
clipboard.html: js now in clipboard_gallery.js
haricot Feb 27, 2020
bf14f8f
add folders import to group
haricot Feb 27, 2020
66a7871
add demo in demo folder
haricot Feb 27, 2020
f20d1cf
optimize ui
haricot Feb 27, 2020
cceca90
test dev branch etangled
haricot Feb 27, 2020
d84b9ef
test django-entangled branch develop
haricot Feb 27, 2020
af5aa4b
Update with django-entangled nested form
haricot Feb 28, 2020
7a57535
wip django-entangled nested form
haricot Feb 28, 2020
c0e244d
Update dev requirements django-entangled develop
haricot Feb 28, 2020
f72dc63
add `class ManageNestedFormMixin`
haricot Mar 3, 2020
b6c09d3
Merge branch 'widget_attrs_group_nested' of https://github.com/harico…
haricot Mar 3, 2020
04a1fb2
make loading of icon plugins configurable
jrief Mar 4, 2020
d160c58
Revert "fix: Pasting of invalid trees via clipboard raises exception"
haricot Mar 4, 2020
f5de010
Revert "clean code"
haricot Mar 4, 2020
881d34f
fix import path in tests
jrief Mar 5, 2020
5875d5e
revert modif
haricot Mar 5, 2020
ba99e8e
Fix color/background-color and inherit_color attr
haricot Mar 5, 2020
f105e81
Fix travis python3.7 lxml test/requirements.txt
haricot Mar 5, 2020
ce2ed48
Fix travis python3.7 lxml in tox.ini
haricot Mar 5, 2020
e04e1b1
Update test/requirements.txt fix travis lxml
haricot Mar 5, 2020
2fb9962
Add `Class ColorFieldExtra` inherit_color=True
haricot Mar 5, 2020
a66364d
use ColorFieldExtra (inherit_color=True)
haricot Mar 5, 2020
64b01d3
Merge pull request #32 from haricot/patch-53
haricot Mar 5, 2020
d02eb43
Merge pull request #35 from haricot/compact_form_widget_attr_sav
haricot Mar 5, 2020
428dfda
fix merge
haricot Mar 5, 2020
bc2e78c
fix merge
haricot Mar 5, 2020
15c4ad3
git push origin haricotMerge branch 'patch-34' into haricot
haricot Mar 5, 2020
27cf5c2
Update accordion.py (revert)
haricot Mar 5, 2020
2201177
fix syntax
haricot Mar 5, 2020
db33af4
fix import unneeded
haricot Mar 5, 2020
f067d85
fix revert est_accordion.py
haricot Mar 5, 2020
5aeae82
Merge branch 'cascade_mix' into clipboard_library_groups
haricot Mar 5, 2020
8d53a21
Merge pull request #38 from haricot/clipboard_library_groups
haricot Mar 5, 2020
8c9bcd3
fix import entangled
haricot Mar 5, 2020
edf7898
fix test
haricot Mar 5, 2020
3501ecc
fix test requirements entangled
haricot Mar 5, 2020
7d42795
fix version string
jrief Mar 5, 2020
94101d4
fix import
haricot Mar 5, 2020
fa74669
fix import link/plugin_base.py
haricot Mar 5, 2020
a64e4a7
fix import link/formsy
haricot Mar 5, 2020
7867056
fix import bootstrap4/embeds.py
haricot Mar 5, 2020
52965a6
revert accordion.html
haricot Mar 5, 2020
edc4bf6
fix merge
haricot Mar 5, 2020
72a9134
fix merge
haricot Mar 5, 2020
74be053
complete mixin property
haricot Mar 5, 2020
89668a5
fix compact form init
haricot Mar 5, 2020
e6489df
Update dev branch 1.3
haricot Mar 5, 2020
b67c189
git push origin cascade_mixMerge branch 'jrief-releases/1.3' into cas…
haricot Mar 5, 2020
4731bd8
clean code
haricot Mar 5, 2020
373f8c6
remove feature class ExtraFieldsPluginFormMixin
haricot Mar 6, 2020
5def0e8
remove 'configuration of the plugin directly in its form'
haricot Mar 6, 2020
649e7cc
Update conftest.py
haricot Mar 6, 2020
5b7fac9
Update mixins.py
haricot Mar 6, 2020
17e0724
Merge branch 'cascade_mix' into patch-34
haricot Mar 6, 2020
c4bc9d1
fix syntax tuple
haricot Mar 6, 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
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ insert_final_newline = false
trim_trailing_whitespace = false

# Set default charset
[*.{js,py,rst,json,yml,html,txt,scss}]
[*.{js,py,rst,json,yml,html,txt,css,scss}]
charset = utf-8

[*.{js,py,rst,yml,html,scss}]
Expand All @@ -18,7 +18,7 @@ line_length=119
indent_style = space
indent_size = 4

[*.{html,js,rst,scss}]
[*.{html,js,rst,css,scss}]
indent_style = tab
indent_size = 4

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ workdir/
filer_public/
filer_public_thumbnails/
examples/bs3demo/private_settings.py
.venv/
poetry.lock
2 changes: 1 addition & 1 deletion cmsplugin_cascade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
15. git commit -m 'Start with <version>'
16. git push
"""
__version__ = "1.2.3"
__version__ = "1.3.dev"

default_app_config = 'cmsplugin_cascade.apps.CascadeConfig'
15 changes: 13 additions & 2 deletions cmsplugin_cascade/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def CMSPLUGIN_CASCADE(self):
from django.forms.fields import NumberInput
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy
from cmsplugin_cascade.fields import (ColorField, SelectTextAlignField, SelectOverflowField, SizeField,
from cmsplugin_cascade.fields import (ColorFieldExtra, SelectTextAlignField, SelectOverflowField, SizeField,
BorderChoiceField)

if hasattr(self, '_config_CMSPLUGIN_CASCADE'):
Expand Down Expand Up @@ -96,7 +96,7 @@ def CMSPLUGIN_CASCADE(self):
(['line-height'], NumberInput))
extra_inline_styles.setdefault(
'Colors',
(['color', 'background-color'], ColorField))
(['color', 'background-color'], ColorFieldExtra))
extra_inline_styles.setdefault(
'Border',
(['border', 'border-top', 'border-right', 'border-bottom', 'border-left'], BorderChoiceField))
Expand Down Expand Up @@ -130,7 +130,18 @@ def CMSPLUGIN_CASCADE(self):

config.setdefault('cache_strides', True)

config.setdefault('merge_extra_fields',True)

config.setdefault('fallback',{
# default
'path_main_scss': 'bs4demo/css/main.scss',
'image':{'color':'hsla(221.7, 57.5%, 84.3%, 0.8)', 'svg':''},
'picture':{'color':'hsla(0, 40%, 80.4%, 0.8)', 'svg':'' },
'jumbotron':{'color':'hsl(62, 90%, 90%, 0.8)', 'svg':''},
})

config.setdefault('register_page_editor', True)


for module_name in self.CASCADE_PLUGINS:
try:
Expand Down
8 changes: 7 additions & 1 deletion cmsplugin_cascade/bootstrap4/accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cmsplugin_cascade.plugin_base import TransparentWrapper, TransparentContainer
from cmsplugin_cascade.widgets import NumberInputWidget
from .plugin_base import BootstrapPluginBase

from cmsplugin_cascade.helpers import used_compact_form, entangled_nested

class AccordionFormMixin(ManageChildrenFormMixin, EntangledModelFormMixin):
num_children = IntegerField(
Expand All @@ -35,6 +35,9 @@ class AccordionFormMixin(ManageChildrenFormMixin, EntangledModelFormMixin):
help_text=_("Start with the first card open.")
)

if used_compact_form:
entangled_nested(num_children, close_others,first_is_open, data_nested='accordion')

class Meta:
untangled_fields = ['num_children']
entangled_fields = {'glossary': ['close_others', 'first_is_open']}
Expand Down Expand Up @@ -85,6 +88,9 @@ class AccordionGroupFormMixin(EntangledModelFormMixin):
help_text=_("Add standard padding to card body."),
)

if used_compact_form:
entangled_nested(heading,body_padding, data_nested='accordion_group')

class Meta:
entangled_fields = {'glossary': ['heading', 'body_padding']}

Expand Down
17 changes: 15 additions & 2 deletions cmsplugin_cascade/bootstrap4/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from cmsplugin_cascade.icon.forms import IconFormMixin
from cmsplugin_cascade.link.config import LinkPluginBase, LinkFormMixin
from cmsplugin_cascade.link.plugin_base import LinkElementMixin
from cmsplugin_cascade.helpers import used_compact_form, entangled_nested

from sass_processor.processor import sass_processor
sass_processor('cascade/css/admin/compact_forms/bootstrap4-colors.scss')

class ButtonTypeWidget(widgets.RadioSelect):
"""
Expand All @@ -24,7 +27,6 @@ class ButtonSizeWidget(widgets.RadioSelect):
"""
template_name = 'cascade/admin/legacy_widgets/button_sizes.html' if DJANGO_VERSION < (2, 0) else 'cascade/admin/widgets/button_sizes.html'


class ButtonFormMixin(EntangledModelFormMixin):
BUTTON_TYPES = [
('btn-primary', _("Primary")),
Expand Down Expand Up @@ -104,20 +106,27 @@ class ButtonFormMixin(EntangledModelFormMixin):
help_text=_("Add an Icon before or after the button content."),
)

if used_compact_form:
entangled_nested(link_content,button_type,button_size,button_options,\
stretched_link, data_nested='button')
entangled_nested(button_type, data_nested='button', template_key='button_type')
entangled_nested(icon_align, data_nested='icon')

class Meta:
entangled_fields = {'glossary': ['link_content', 'button_type', 'button_size', 'button_options', 'icon_align',
'stretched_link']}


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'
default_css_attributes = ['button_type', 'button_size', 'button_options', 'stretched_link']
ring_plugin = 'ButtonMixin'


class Media:
css = {'all': ['cascade/css/admin/bootstrap4-buttons.css', 'cascade/css/admin/iconplugin.css']}
js = ['admin/js/jquery.init.js', 'cascade/js/admin/buttonmixin.js']
Expand Down Expand Up @@ -148,6 +157,7 @@ class BootstrapButtonPlugin(BootstrapButtonMixin, LinkPluginBase):
form = BootstrapButtonFormMixin
ring_plugin = 'ButtonPlugin'
DEFAULT_BUTTON_ATTRIBUTES = {'role': 'button'}
# render_template_fallback = "cascade/generic/fallback_button.html" # mode stride gallery

class Media:
js = ['admin/js/jquery.init.js', 'cascade/js/admin/buttonplugin.js']
Expand All @@ -168,6 +178,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
4 changes: 4 additions & 0 deletions cmsplugin_cascade/bootstrap4/carousel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from cmsplugin_cascade.bootstrap4.utils import IMAGE_RESIZE_OPTIONS
from cmsplugin_cascade.forms import ManageChildrenFormMixin
from cmsplugin_cascade.image import ImagePropertyMixin, ImageFormMixin
from cmsplugin_cascade.helpers import used_compact_form, entangled_nested

logger = logging.getLogger('cascade')

Expand Down Expand Up @@ -55,6 +56,9 @@ class CarouselSlidesFormMixin(ManageChildrenFormMixin, EntangledModelFormMixin):
initial=['upscale', 'crop', 'subject_location', 'high_resolution'],
)

if used_compact_form:
entangled_nested(resize_options, container_max_heights,options,interval,num_children, data_nested='carousel')

class Meta:
untangled_fields = ['num_children']
entangled_fields = {'glossary': ['interval', 'options', 'container_max_heights', 'resize_options']}
Expand Down
37 changes: 30 additions & 7 deletions cmsplugin_cascade/bootstrap4/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from cmsplugin_cascade import app_settings
from cmsplugin_cascade.bootstrap4.grid import Breakpoint
from cmsplugin_cascade.forms import ManageChildrenFormMixin
from cmsplugin_cascade.helpers import entangled_nested, used_compact_form
from .plugin_base import BootstrapPluginBase
from . import grid

Expand All @@ -19,17 +20,26 @@ def get_widget_choices():
breakpoints = app_settings.CMSPLUGIN_CASCADE['bootstrap4']['fluid_bounds']
widget_choices = []
for index, (bp, bound) in enumerate(breakpoints.items()):
if index == 0:
widget_choices.append((bp.name, "{} (<{:.1f}px)".format(bp.label, bound.max)))
elif index == len(breakpoints) - 1:
widget_choices.append((bp.name, "{} (≥{:.1f}px)".format(bp.label, bound.min)))
if not used_compact_form:
if index == 0:
widget_choices.append((bp.name, "{} (<{:.1f}px)".format(bp.label, bound.max)))
elif index == len(breakpoints) - 1:
widget_choices.append((bp.name, "{} (≥{:.1f}px)".format(bp.label, bound.min)))
else:
widget_choices.append((bp.name, "{} (≥{:.1f}px and <{:.1f}px)".format(bp.label, bound.min, bound.max)))
else:
widget_choices.append((bp.name, "{} (≥{:.1f}px and <{:.1f}px)".format(bp.label, bound.min, bound.max)))
if index == 0:
widget_choices.append((bp.name, "{} <{:.1f}px".format(bp._name_, bound.max)))
else:
widget_choices.append((bp.name, "{} ≥{:.1f}px".format(bp._name_, bound.min)))
return widget_choices


class ContainerBreakpointsWidget(widgets.CheckboxSelectMultiple):
template_name = 'cascade/admin/legacy_widgets/container_breakpoints.html' if DJANGO_VERSION < (2, 0) else 'cascade/admin/widgets/container_breakpoints.html'
if not used_compact_form:
template_name = 'cascade/admin/legacy_widgets/container_breakpoints.html' if DJANGO_VERSION < (2, 0) else 'cascade/admin/widgets/container_breakpoints.html'
else:
template_name = 'cascade/admin/compact_forms/widgets/container_breakpoints.html'


class ContainerFormMixin(EntangledModelFormMixin):
Expand All @@ -48,6 +58,9 @@ class ContainerFormMixin(EntangledModelFormMixin):
help_text=_("Changing your outermost '.container' to '.container-fluid'.")
)

if used_compact_form:
entangled_nested( breakpoints, fluid, data_nested="container")

class Meta:
entangled_fields = {'glossary': ['breakpoints', 'fluid']}

Expand Down Expand Up @@ -121,6 +134,9 @@ class BootstrapRowFormMixin(ManageChildrenFormMixin, EntangledModelFormMixin):
help_text=_('Number of columns to be created with this row.'),
)

if used_compact_form:
entangled_nested( num_children, data_nested="row")

class Meta:
untangled_fields = ['num_children']

Expand Down Expand Up @@ -196,7 +212,7 @@ def choose_help_text(*phrases):
return phrases[1].format(bs4_breakpoints[first].min)
else:
return phrases[2]

if 'parent' in self._cms_initial_attributes:
container=self._cms_initial_attributes['parent'].get_ancestors().order_by('depth').last().get_bound_plugin()
else:
Expand Down Expand Up @@ -325,6 +341,13 @@ def choose_help_text(*phrases):
glossary_fields.extend(reorder_fields.keys())
glossary_fields.extend(responsive_fields.keys())


if used_compact_form:
entangled_nested(width_fields, data_nested="column", template_key="column", )
entangled_nested(offset_fields, data_nested="offset", template_key="column", )
entangled_nested(reorder_fields, data_nested="reorder", template_key="column",)
entangled_nested(responsive_fields, data_nested="responsive", template_key="column")

class Meta:
entangled_fields = {'glossary': glossary_fields}

Expand Down
6 changes: 5 additions & 1 deletion cmsplugin_cascade/bootstrap4/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from cmsplugin_cascade.link.plugin_base import LinkElementMixin
from cmsplugin_cascade.icon.forms import IconFormMixin
from cmsplugin_cascade.icon.plugin_base import IconPluginMixin

from cmsplugin_cascade.helpers import used_compact_form, entangled_nested

class FramedIconFormMixin(IconFormMixin):
SIZE_CHOICES = [('{}em'.format(c), "{} em".format(c)) for c in range(1, 13)]
Expand Down Expand Up @@ -56,6 +56,10 @@ class FramedIconFormMixin(IconFormMixin):
required=False,
)

if used_compact_form:
entangled_nested(font_size, color, background_color, text_align, border,
border_radius, data_nested='icon')

class Meta:
entangled_fields = {'glossary': ['font_size', 'color', 'background_color', 'text_align', 'border',
'border_radius']}
Expand Down
5 changes: 5 additions & 0 deletions cmsplugin_cascade/bootstrap4/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from cmsplugin_cascade.fields import SizeField
from cmsplugin_cascade.link.config import LinkPluginBase, LinkFormMixin
from cmsplugin_cascade.link.plugin_base import LinkElementMixin
from cmsplugin_cascade.helpers import used_compact_form, entangled_nested

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

Expand Down Expand Up @@ -67,6 +68,10 @@ class BootstrapImageFormMixin(ImageFormMixin):
help_text=_("How to align a non-responsive image."),
)

if used_compact_form:
entangled_nested(image_shapes, image_width_responsive, image_width_fixed,
image_height, resize_options, image_alignment, data_nested='image_setting')

class Meta:
entangled_fields = {'glossary': ['image_shapes', 'image_width_responsive', 'image_width_fixed',
'image_height', 'resize_options', 'image_alignment']}
Expand Down
7 changes: 7 additions & 0 deletions cmsplugin_cascade/bootstrap4/jumbotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from cmsplugin_cascade.bootstrap4.container import ContainerGridMixin
from cmsplugin_cascade.bootstrap4.fields import BootstrapMultiSizeField
from cmsplugin_cascade.bootstrap4.picture import get_picture_elements
from cmsplugin_cascade.helpers import entangled_nested, used_compact_form

logger = logging.getLogger('cascade')

Expand Down Expand Up @@ -154,6 +155,11 @@ class JumbotronFormMixin(EntangledModelFormMixin):
help_text=_("This property specifies the width and height of a background image in px or %."),
)

if used_compact_form:
entangled_nested(fluid, background_color, element_heights, image_file,
background_repeat, background_attachment,
background_vertical_position, background_horizontal_position,
background_size, background_width_height, data_nested='jumbotron')
class Meta:
entangled_fields = {'glossary': ['fluid', 'background_color', 'element_heights', 'image_file',
'background_repeat', 'background_attachment',
Expand Down Expand Up @@ -195,6 +201,7 @@ class BootstrapJumbotronPlugin(BootstrapPluginBase):
form = JumbotronFormMixin
raw_id_fields = ['image_file']
render_template = 'cascade/bootstrap4/jumbotron.html'
render_template_fallback = "cascade/generic/fallback_jumbotron.html" # mode stride gallery
ring_plugin = 'JumbotronPlugin'
footnote_html = """<p>
For more information about the Jumbotron please read the
Expand Down
64 changes: 64 additions & 0 deletions cmsplugin_cascade/bootstrap4/lists.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from .plugin_base import BootstrapPluginBase
from django.forms.fields import ChoiceField
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)

Loading