""" HTML blocks are simple blocks used to represent common HTML elements, with additional styling and attributes. HTML blocks should NOT contain more sub-blocks or sub-streamfields. They must be safe to nest within more robust "content blocks" without creating recursion. """ import logging from django.utils.translation import gettext_lazy as _ from wagtail.contrib.table_block.blocks import TableBlock as WagtailTableBlock from wagtail import blocks from wagtail.documents.blocks import DocumentChooserBlock from wagtail.embeds.blocks import EmbedBlock from wagtail.images.blocks import ImageChooserBlock from .base_blocks import ( BaseBlock, BaseLinkBlock, ButtonMixin, ClassifierTermChooserBlock, CoderedAdvTrackingSettings, LinkStructValue, ) logger = logging.getLogger('wagtailcrx') class ButtonBlock(ButtonMixin, BaseLinkBlock): """ A link styled as a button. """ class Meta: template = 'wagtailcrx/blocks/button_block.html' icon = 'cr-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 = 'wagtailcrx/blocks/download_block.html' icon = 'download' label = _('Download') class EmbedGoogleMapBlock(BaseBlock): """ An embedded Google map in an