How to use the coderedcms.blocks.base_blocks.BaseBlock function in coderedcms

To help you get started, we’ve selected a few coderedcms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coderedcorp / coderedcms / coderedcms / blocks / html_blocks.py View on Github external
map_zoom_level = blocks.IntegerBlock(
        required=False,
        default=14,
        label=_('Map zoom level'),
        help_text=_(
            "Requires API key to use zoom. 1: World, 5: Landmass/continent, 10: City, 15: Streets, 20: Buildings"  # noqa
        )
    )

    class Meta:
        template = 'coderedcms/blocks/google_map.html'
        icon = 'fa-map'
        label = _('Google Map')


class EmbedVideoBlock(BaseBlock):
    """
    Emedded media using stock wagtail functionality.
    """
    url = EmbedBlock(
        required=True,
        label=_('URL'),
        help_text=_('Link to a YouTube/Vimeo video, tweet, facebook post, etc.')
    )

    class Meta:
        template = 'coderedcms/blocks/embed_video_block.html'
        icon = 'media'
        label = _('Embed Media')


class H1Block(BaseBlock):
github coderedcorp / coderedcms / coderedcms / blocks / content_blocks.py View on Github external
label = _('Card')


class CarouselBlock(BaseBlock):
    """
    Enables choosing a Carousel snippet.
    """
    carousel = SnippetChooserBlock('coderedcms.Carousel')

    class Meta:
        icon = 'image'
        label = _('Carousel')
        template = 'coderedcms/blocks/carousel_block.html'


class ImageGalleryBlock(BaseBlock):
    """
    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):
github coderedcorp / coderedcms / coderedcms / blocks / content_blocks.py View on Github external
class NavDocumentLinkBlock(NavBaseLinkBlock):
    """
    Document link.
    """
    document = DocumentChooserBlock(
        label=_('Document'),
    )

    class Meta:
        template = 'coderedcms/blocks/document_link_block.html'
        label = _('Document Link')


class NavSubLinkBlock(BaseBlock):
    """
    Streamblock for rendering nested sub-links.
    """
    sub_links = blocks.StreamBlock(
        [
            ('page_link', NavPageLinkBlock()),
            ('external_link', NavExternalLinkBlock()),
            ('document_link', NavDocumentLinkBlock()),
        ],
        required=False,
        label=_('Sub-links'),
    )


class NavExternalLinkWithSubLinkBlock(NavSubLinkBlock, NavExternalLinkBlock):
    """
github coderedcorp / coderedcms / coderedcms / blocks / html_blocks.py View on Github external
class H2Block(BaseBlock):
    """
    An <h2> heading.
    """
    text = blocks.CharBlock(
        max_length=255,
        label=_('Text'),
    )

    class Meta:
        template = 'coderedcms/blocks/h2_block.html'
        icon = 'fa-header'
        label = _('Heading 2')


class H3Block(BaseBlock):
    """
    An </h2><h3> heading.
    """
    text = blocks.CharBlock(
        max_length=255,
        label=_('Text'),
    )

    class Meta:
        template = 'coderedcms/blocks/h3_block.html'
        icon = 'fa-header'
        label = _('Heading 3')


class TableBlock(BaseBlock):
    table = WagtailTableBlock()</h3>
github coderedcorp / coderedcms / coderedcms / blocks / content_blocks.py View on Github external
rows=4,
        label=_('Description'),
    )
    price = blocks.CharBlock(
        required=True,
        label=_('Price'),
        help_text=_('Any text here. Include currency sign if desired.'),
    )

    class Meta:
        template = 'coderedcms/blocks/pricelistitem_block.html'
        icon = 'fa-usd'
        label = _('Price List Item')


class PriceListBlock(BaseBlock):
    """
    A price list, such as a menu for a restaurant.
    """
    heading = blocks.CharBlock(
        required=False,
        max_length=255,
        label=_('Heading'),
    )
    items = blocks.StreamBlock(
        [
            ('item', PriceListItemBlock()),
        ],
        label=_('Items'),
    )

    class Meta:
github coderedcorp / coderedcms / coderedcms / blocks / stream_form_blocks.py View on Github external
required=False,
        max_length=255,
        label=_('Condition Trigger ID'),
        help_text=_(
            'The "Custom ID" of another field that that will trigger this field to be shown/hidden.')  # noqa
    )
    condition_trigger_value = blocks.CharBlock(
        required=False,
        max_length=255,
        label=_('Condition Trigger Value'),
        help_text=_(
            'The value of the field in "Condition Trigger ID" that will trigger this field to be shown.')  # noqa
    )


class FormBlockMixin(BaseBlock):
    class Meta:
        abstract = True

    advsettings_class = CoderedFormAdvSettings


class CoderedStreamFormFieldBlock(form_blocks.OptionalFormFieldBlock, FormBlockMixin):
    pass


class CoderedStreamFormCharFieldBlock(form_blocks.CharFieldBlock, FormBlockMixin):
    class Meta:
        label = _("Text or Email input")
        icon = "fa-window-minimize"
github coderedcorp / coderedcms / coderedcms / blocks / html_blocks.py View on Github external
try:
                    pages = pages.filter(classifier_terms=value['classified_by'])
                except AttributeError:
                    # `pages` is not a queryset, or is not a queryset of CoderedPage.
                    logger.warning(
                        "Tried to filter by ClassifierTerm in PageListBlock, but &lt;%s.%s ('%s')&gt;.get_index_children()  # noqadid not return a queryset or is not a queryset of CoderedPage models.",  # noqa
                        indexer._meta.app_label, indexer.__class__.__name__, indexer.title
                    )
        else:
            pages = indexer.get_children().live()

        context['pages'] = pages[:value['num_posts']]
        return context


class PagePreviewBlock(BaseBlock):
    """
    Renders a preview of a specific page.
    """
    page = blocks.PageChooserBlock(
        required=True,
        label=_('Page to preview'),
        help_text=_('Show a mini preview of the selected page.'),
    )

    class Meta:
        template = 'coderedcms/blocks/pagepreview_block.html'
        icon = 'doc-empty-inverse'
        label = _('Page Preview')


class QuoteBlock(BaseBlock):
github coderedcorp / coderedcms / coderedcms / blocks / content_blocks.py View on Github external
footer = blocks.StreamBlock(
        [
            ('text', blocks.CharBlock(icon='fa-file-text-o', max_length=255, label=_('Simple Text'))),
            ('button', ButtonBlock()),
        ],
        required=False,
        label=_('Modal footer'),
    )

    class Meta:
        template = 'coderedcms/blocks/modal_block.html'
        icon = 'fa-window-maximize'
        label = _('Modal')


class NavBaseLinkBlock(BaseBlock):
    display_text = blocks.CharBlock(
        required=False,
        max_length=255,
        label=_('Display text'),
    )
    image = ImageChooserBlock(
        required=False,
        label=_('Image'),
    )


class NavExternalLinkBlock(NavBaseLinkBlock):
    """
    External link.
    """
    link = blocks.CharBlock(
github coderedcorp / coderedcms / coderedcms / blocks / html_blocks.py View on Github external
label=_('Auto download'),
    )
    downloadable_file = DocumentChooserBlock(
        required=False,
        label=_('Document link'),
    )

    advsettings_class = CoderedAdvTrackingSettings

    class Meta:
        template = 'coderedcms/blocks/download_block.html'
        icon = 'download'
        label = _('Download')


class EmbedGoogleMapBlock(BaseBlock):
    """
    An embedded Google map in an 
github coderedcorp / coderedcms / coderedcms / blocks / content_blocks.py View on Github external
label=_('Heading'),
    )
    items = blocks.StreamBlock(
        [
            ('item', PriceListItemBlock()),
        ],
        label=_('Items'),
    )

    class Meta:
        template = 'coderedcms/blocks/pricelist_block.html'
        icon = 'fa-usd'
        label = _('Price List')


class ContentWallBlock(BaseBlock):
    """
    Enables choosing a ContentWall snippet.
    """
    content_wall = SnippetChooserBlock('coderedcms.ContentWall')
    show_content_wall_on_children = blocks.BooleanBlock(
        required=False,
        default=False,
        verbose_name=_('Show content walls on children pages?'),
        help_text=_('If this is checked, the content walls will be displayed on all children pages of this page.')
    )
    class Meta:
        icon = 'fa-stop'
        label = _('Content Wall')
        template = 'coderedcms/blocks/content_wall_block.html'