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

Clipboard library groups #376

Open
wants to merge 77 commits into
base: releases/1.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
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
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
4182f39
Restore context['request'] fot stride
haricot Mar 7, 2020
33560b1
Restore context['request'] for stride
haricot Mar 7, 2020
bfa9ae2
Restore context['request'] for stride and cache sekizai_context
haricot Mar 7, 2020
82bc3fc
add css delimiter border before stride svg
haricot Mar 7, 2020
fb66ee5
serialize_from_placeholder() filter language
haricot Mar 11, 2020
65b067f
add_to_clipboard() filter language
haricot Mar 11, 2020
54ed01b
Merge pull request #44 from jrief/releases/1.3
haricot Mar 11, 2020
435ff61
Merge branch 'clipboard_library_groups' into add_to_clipboard_filter_…
haricot Mar 11, 2020
a8bc6e1
Merge branch 'releases/1.3' into clipboard_library_groups
haricot Mar 11, 2020
15e54a0
Merge pull request #46 from haricot/patch-53
haricot Mar 11, 2020
e811f3d
Merge branch 'clipboard_library_groups' into add_to_clipboard_filter_…
haricot Mar 11, 2020
59faec3
Merge pull request #45 from haricot/add_to_clipboard_filter_lang
haricot Mar 11, 2020
15ed366
Update 0028_cascade_clipboard.py
haricot Mar 11, 2020
eb8ecd1
Delete 0028_auto_20200218_1514.py
haricot Mar 11, 2020
c7a328f
update logic if not cascade_clipboard.data
haricot Mar 12, 2020
f2fa244
Merge branch 'releases/1.3' into clipboard_library_groups
haricot Apr 12, 2020
e17077b
Correct:Export form Clipboard=>Export to Clipboard
haricot Apr 12, 2020
466b9b6
fix _image_properties to image_properties
haricot Apr 13, 2020
12af399
fix fallback if plugin has require_image False
haricot Apr 13, 2020
0fb4094
refix fallback if plugin has require_image False
haricot Apr 13, 2020
cd4690a
fix clipboard demo did not have 'image_properties'
haricot Apr 13, 2020
a743f3a
refix fallback
haricot Apr 13, 2020
8931856
fix redis_cache "Must pass in a callable"
haricot Apr 16, 2020
89ba45a
Corrected fallback picture
haricot Apr 21, 2020
56688b2
image.py:Correct cleaned_data image_properties
haricot Apr 21, 2020
d95108c
Corrected Image fallback
haricot Apr 21, 2020
8a16da5
if CMSPLUGIN_CASCADE['fallback']['img_or_pic_lost_pk']
haricot Apr 21, 2020
0e8d68e
if settings.CMSPLUGIN_CASCADE.get('fallback', None ).get('img_or_pic_…
haricot Apr 21, 2020
3c2ab71
Update clipboard.css
haricot Apr 22, 2020
a9cb273
Functionality refactoring
haricot Apr 22, 2020
b71d8d3
Update cms_plugins.py
haricot Apr 22, 2020
641b5ae
Update cms_plugins.py
haricot Apr 22, 2020
eeff3bf
Create clipboard_import.html
haricot Apr 22, 2020
5ea1b2a
Update app_settings.py
haricot Apr 22, 2020
c04cd33
Delete clipboard.html
haricot Apr 22, 2020
c5ca6f1
remove uneeded attribute input
haricot Apr 23, 2020
a473df0
Merge branch 'releases/1.3' into clipboard_library_groups
haricot Oct 30, 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
12 changes: 12 additions & 0 deletions cmsplugin_cascade/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ def CMSPLUGIN_CASCADE(self):

config.setdefault('register_page_editor', True)


config.setdefault('fallback',{
# default
'path_main_scss': 'bs4demo/css/main.scss',
'path_main_scss': 'myshop/css/default.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':''},
'img_or_pic_lost_pk': True,
})


for module_name in self.CASCADE_PLUGINS:
try:
settings_module = import_module('{}.settings'.format(module_name))
Expand Down
2 changes: 2 additions & 0 deletions cmsplugin_cascade/bootstrap4/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class BootstrapButtonMixin(IconPluginMixin):
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 @@ -147,6 +148,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 Down
1 change: 1 addition & 0 deletions cmsplugin_cascade/bootstrap4/jumbotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,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
14 changes: 12 additions & 2 deletions cmsplugin_cascade/bootstrap4/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def get_image_tags(instance):
aspect_ratio = compute_aspect_ratio(instance.image)
elif 'image' in instance.glossary and 'width' in instance.glossary['image']:
aspect_ratio = compute_aspect_ratio_with_glossary(instance.glossary)
# fallback logic
elif 'image_properties' in instance.glossary and 'width' in instance.glossary['image_properties']:
aspect_ratio = compute_aspect_ratio_with_glossary(instance.glossary)
else:
# if accessing the image file fails or fake image fails, abort here
raise FileNotFoundError("Unable to compute aspect ratio of image")
Expand All @@ -52,7 +55,11 @@ def get_image_tags(instance):
else:
image_width = parse_responsive_length(instance.glossary['image_width_fixed'])
if not image_width[0]:
image_width = (instance.image.width, image_width[1])
if hasattr(instance,'image' ) and hasattr(instance.image,'width' ) :
image_width = (instance.image.width, image_width[1])
# logic fallback
else:
image_width = (instance.glossary['image_properties']['width'],image_width[1] )
try:
image_height = parse_responsive_length(instance.glossary['image_height'])
except KeyError:
Expand Down Expand Up @@ -99,7 +106,10 @@ def get_picture_elements(instance):

if hasattr(instance, 'image') and hasattr(instance.image, 'exif'):
aspect_ratio = compute_aspect_ratio(instance.image)
elif 'image' in instance.glossary and 'width' in instance.glossary['image']:
# fallback logic picture
elif 'image' in instance.glossary and 'width' in instance.glossary['image']:
aspect_ratio = compute_aspect_ratio_with_glossary(instance.glossary)
elif 'image_properties' in instance.glossary and 'width' in instance.glossary['image_properties']:
aspect_ratio = compute_aspect_ratio_with_glossary(instance.glossary)
else:
# if accessing the image file fails or fake image fails, abort here
Expand Down
9 changes: 6 additions & 3 deletions cmsplugin_cascade/clipboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from jsonfield.fields import JSONField

from cms.models.placeholderpluginmodel import PlaceholderReference
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from cmsplugin_cascade.clipboard.utils import deserialize_to_clipboard, serialize_from_placeholder
from cmsplugin_cascade.models import CascadeClipboard

from cmsplugin_cascade.models import CascadeClipboard, CascadeClipboardGroup

class JSONAdminWidget(widgets.Textarea):
def __init__(self):
Expand All @@ -36,10 +36,13 @@ def render(self, name, value, attrs=None, renderer=None):
_("Successfully pasted JSON data"),
_("Successfully copied JSON data"))

@admin.register(CascadeClipboardGroup)
class GroupModelAdmin(PlaceholderAdminMixin, admin.ModelAdmin):
pass

@admin.register(CascadeClipboard)
class CascadeClipboardAdmin(admin.ModelAdmin):
fields = ['identifier', ('created_by', 'created_at', 'last_accessed_at'), 'save_clipboard', 'restore_clipboard', 'data']
fields = ['identifier', 'group', ('created_by', 'created_at', 'last_accessed_at'), 'save_clipboard', 'restore_clipboard', 'data']
readonly_fields = ['created_by', 'created_at', 'last_accessed_at', 'save_clipboard', 'restore_clipboard']
formfield_overrides = {
JSONField: {'widget': JSONAdminWidget},
Expand Down
Loading