Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Show a collection of images with interactive previews that expand to
full size images in a modal.
"""
collection = CollectionChooserBlock(
required=True,
label=_('Image Collection'),
)
class Meta:
template = 'coderedcms/blocks/image_gallery_block.html'
icon = 'image'
label = _('Image Gallery')
class ModalBlock(ButtonMixin, BaseLayoutBlock):
"""
Renders a button that then opens a popup/modal with content.
"""
header = blocks.CharBlock(
required=False,
max_length=255,
label=_('Modal heading'),
)
content = blocks.StreamBlock(
[],
label=_('Modal content'),
)
footer = blocks.StreamBlock(
[
('text', blocks.CharBlock(icon='fa-file-text-o', max_length=255, label=_('Simple Text'))),
('button', ButtonBlock()),
from wagtail.images.blocks import ImageChooserBlock
from .base_blocks import (
BaseBlock,
BaseLinkBlock,
ButtonMixin,
ClassifierTermChooserBlock,
CoderedAdvTrackingSettings,
LinkStructValue,
)
logger = logging.getLogger('coderedcms')
class ButtonBlock(ButtonMixin, BaseLinkBlock):
"""
A link styled as a button.
"""
class Meta:
template = 'coderedcms/blocks/button_block.html'
icon = 'fa-hand-pointer-o'
label = _('Button Link')
value_class = LinkStructValue
class DownloadBlock(ButtonMixin, BaseBlock):
"""
Link to a file that can be downloaded.
"""
automatic_download = blocks.BooleanBlock(
required=False,
logger = logging.getLogger('coderedcms')
class ButtonBlock(ButtonMixin, BaseLinkBlock):
"""
A link styled as a button.
"""
class Meta:
template = 'coderedcms/blocks/button_block.html'
icon = 'fa-hand-pointer-o'
label = _('Button Link')
value_class = LinkStructValue
class DownloadBlock(ButtonMixin, BaseBlock):
"""
Link to a file that can be downloaded.
"""
automatic_download = blocks.BooleanBlock(
required=False,
label=_('Auto download'),
)
downloadable_file = DocumentChooserBlock(
required=False,
label=_('Document link'),
)
advsettings_class = CoderedAdvTrackingSettings
class Meta:
template = 'coderedcms/blocks/download_block.html'