diff --git a/collective/behavior/relatedmedia/behavior.py b/collective/behavior/relatedmedia/behavior.py index b592c8e0..a2be3b00 100644 --- a/collective/behavior/relatedmedia/behavior.py +++ b/collective/behavior/relatedmedia/behavior.py @@ -68,6 +68,12 @@ def default_preview_scale_direction(): ) +def default_gallery_large_image_scale(): + return api.portal.get_registry_record( + "collective.behavior.relatedmedia.image_gallery_default_large_scale", default="large" + ) + + def default_titles_as_caption(): return api.portal.get_registry_record( "collective.behavior.relatedmedia.show_titles_as_caption_default", default=False @@ -208,6 +214,12 @@ class IRelatedMediaBehavior(model.Schema): required=False, ) + large_image_scale = schema.Choice( + title=_("Gallery default scale for large overlay image"), + vocabulary="plone.app.vocabularies.ImagesScales", + defaultFactory=default_gallery_large_image_scale, + ) + gallery_css_class = schema.Choice( title=_("Gallery layout"), description=_("Feel free to add/remove classes in your registry.xml"), @@ -244,6 +256,7 @@ class IRelatedMediaBehavior(model.Schema): "first_image_scale_direction", "preview_scale", "preview_scale_direction", + "large_image_scale", "gallery_css_class", "related_media_base_path", ], diff --git a/collective/behavior/relatedmedia/browser.py b/collective/behavior/relatedmedia/browser.py index 4f96f41f..df42c0b8 100644 --- a/collective/behavior/relatedmedia/browser.py +++ b/collective/behavior/relatedmedia/browser.py @@ -86,6 +86,7 @@ def images(self): first_img_scales = None first_img_description = "" first_img_uuid = "" + large_scale = getattr(rm_behavior, "large_image_scale", "large") further_images = [] gallery = {} @@ -114,7 +115,7 @@ def images(self): or "thumbnail", ) if scale: - large_scale_url = first_img_scales.scale("image", scale="large").url + large_scale_url = first_img_scales.scale("image", scale=large_scale).url gallery[first_img_uuid] = dict( url=large_scale_url, tag=scale.tag( @@ -142,7 +143,7 @@ def images(self): ) uuid = img.UID() if scale: - large_scale_url = scales.scale("image", scale="large").url + large_scale_url = scales.scale("image", scale=large_scale).url gallery[uuid] = dict( url=large_scale_url, tag=scale.tag(css_class="img-fluid"), diff --git a/collective/behavior/relatedmedia/interfaces.py b/collective/behavior/relatedmedia/interfaces.py index cc0ba66c..c39274bd 100644 --- a/collective/behavior/relatedmedia/interfaces.py +++ b/collective/behavior/relatedmedia/interfaces.py @@ -62,6 +62,13 @@ class IRelatedMediaSettings(Interface): required=False, ) + image_gallery_default_large_scale = schema.Choice( + title=_("Gallery default large scale for overlay images"), + vocabulary="plone.app.vocabularies.ImagesScales", + default="large", + required=False, + ) + image_gallery_default_preview_scale_direction = schema.Bool( title=_("Default setting for cropping gallery images"), default=False, diff --git a/collective/behavior/relatedmedia/profiles/default/metadata.xml b/collective/behavior/relatedmedia/profiles/default/metadata.xml index 011d88d6..bdad7593 100644 --- a/collective/behavior/relatedmedia/profiles/default/metadata.xml +++ b/collective/behavior/relatedmedia/profiles/default/metadata.xml @@ -1,4 +1,4 @@ - 3003 + 3004 diff --git a/collective/behavior/relatedmedia/profiles/default/registry.xml b/collective/behavior/relatedmedia/profiles/default/registry.xml index 49f9bda2..e65d4d50 100644 --- a/collective/behavior/relatedmedia/profiles/default/registry.xml +++ b/collective/behavior/relatedmedia/profiles/default/registry.xml @@ -38,6 +38,6 @@ - + diff --git a/collective/behavior/relatedmedia/upgrades.zcml b/collective/behavior/relatedmedia/upgrades.zcml index 75d5e59c..cea68a1d 100644 --- a/collective/behavior/relatedmedia/upgrades.zcml +++ b/collective/behavior/relatedmedia/upgrades.zcml @@ -156,4 +156,13 @@ handler=".upgrades.update_tinymce_settings" /> + +