Skip to content

Layout Blocks

cjkcms.blocks.CardGridBlock

Bases: BaseLayoutBlock

Renders a row of cards.

Source code in cjkcms/blocks/layout_blocks.py
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
class CardGridBlock(BaseLayoutBlock):
    """
    Renders a row of cards.
    """

    fluid = blocks.BooleanBlock(
        required=False,
        label=_("Full width"),
    )

    default_card_template = blocks.ChoiceBlock(
        choices=cms_settings.CJKCMS_FRONTEND_TEMPLATES_BLOCKS["cardblock"],
        default=None,
        required=False,
        label=_("Card Template for this grid"),
        help_text=_(
            "Leave blank to use the default card template in this grid. "
            "Each card may override the grid-level default."
        ),
    )

    class Meta:
        template = "cjkcms/blocks/cardgrid_deck.html"
        icon = "card-grid"
        label = _("Card Grid")
        label_format = _("Card Grid: {content}")

cjkcms.blocks.GridBlock

Bases: BaseLayoutBlock

Renders a row of columns.

Source code in cjkcms/blocks/layout_blocks.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class GridBlock(BaseLayoutBlock):
    """
    Renders a row of columns.
    """

    fluid = blocks.BooleanBlock(
        required=False,
        label=_("Full width"),
    )

    class Meta:
        template = "cjkcms/blocks/grid_block.html"
        icon = "grip"
        label = _("Responsive Grid Row")
        label_format = _("Grid Row: {content}")

    def __init__(self, local_blocks=None, **kwargs):
        super().__init__(local_blocks=[("content", ColumnBlock(local_blocks))])

cjkcms.blocks.HeroBlock

Bases: BaseLayoutBlock

Wrapper with color and image background options.

Source code in cjkcms/blocks/layout_blocks.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
class HeroBlock(BaseLayoutBlock):
    """
    Wrapper with color and image background options.
    """

    fluid = blocks.BooleanBlock(
        required=False,
        default=True,
        label=_("Full width"),
    )
    is_parallax = blocks.BooleanBlock(
        required=False,
        label=_("Parallax Effect"),
        help_text=_(
            "Background images scroll slower than foreground images, creating an illusion of depth."
        ),  # noqa
    )
    background_image = ImageChooserBlock(required=False)
    tile_image = blocks.BooleanBlock(
        required=False,
        default=False,
        label=_("Tile background image"),
    )
    background_color = blocks.CharBlock(
        required=False,
        max_length=255,
        label=_("Background color"),
        help_text=_("Hexadecimal, rgba, or CSS color notation (e.g. #ff0011)"),
    )
    foreground_color = blocks.CharBlock(
        required=False,
        max_length=255,
        label=_("Text color"),
        help_text=_("Hexadecimal, rgba, or CSS color notation (e.g. #ff0011)"),
    )

    class Meta:
        template = "cjkcms/blocks/hero_block.html"
        icon = "newspaper-o"
        label = _("Hero Unit")
        label_format = "Hero Unit: {content}"