Skip to content

Commit

Permalink
[Composants] Listes de cartes et de tuiles (#202)
Browse files Browse the repository at this point in the history
* Add lists of cards and tiles as components

* Add migrations

* Remove irrelevant migrations

* Add new grid component

* Remove obsolete translations
  • Loading branch information
Ash-Crow authored Aug 27, 2024
1 parent c6674a0 commit 982b042
Show file tree
Hide file tree
Showing 8 changed files with 6,727 additions and 248 deletions.
2,585 changes: 2,585 additions & 0 deletions blog/migrations/0032_alter_blogentrypage_body_alter_blogindexpage_body.py

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions content_manager/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from content_manager.constants import (
BUTTON_ICON_SIDE,
BUTTON_TYPE_CHOICES,
GRID_3_4_6_CHOICES,
HEADING_CHOICES,
HEADING_CHOICES_2_5,
HORIZONTAL_CARD_IMAGE_RATIOS,
Expand Down Expand Up @@ -862,6 +863,19 @@ class ColumnBlock(CommonStreamBlock):
card = VerticalCardBlock(label=_("Vertical card"), group=_("DSFR components"))


class ItemGridBlock(blocks.StructBlock):
column_width = blocks.ChoiceBlock(
label=_("Column width"),
choices=GRID_3_4_6_CHOICES,
default="4",
)
items = ColumnBlock(label=_("Items"))

class Meta:
icon = "grip"
template = "content_manager/blocks/item_grid.html"


class AdjustableColumnBlock(blocks.StructBlock):
width = blocks.ChoiceBlock(
label=_("Column width"),
Expand Down Expand Up @@ -925,6 +939,7 @@ class Meta:
class FullWidthBlock(CommonStreamBlock):
image_and_text = ImageAndTextBlock(label=_("Image and text"))
card = HorizontalCardBlock(label=_("Horizontal card"), group=_("DSFR components"))
item_grid = ItemGridBlock(label=_("Item grid"), group=_("Page structure"))

class Meta:
icon = "minus"
Expand Down Expand Up @@ -1000,6 +1015,7 @@ class Meta:
("iframe", IframeBlock(label=_("Iframe"), group=_("Expert syntax"))),
("separator", SeparatorBlock(label=_("Separator"), group=_("Page structure"))),
("multicolumns", MultiColumnsWithTitleBlock(label=_("Multiple columns"), group=_("Page structure"))),
("item_grid", ItemGridBlock(label=_("Item grid"), group=_("Page structure"))),
("fullwidthbackground", FullWidthBackgroundBlock(label=_("Full width background"), group=_("Page structure"))),
(
"fullwidthbackgroundwithsidemenu",
Expand Down
6 changes: 6 additions & 0 deletions content_manager/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
("fr-btn--icon-right", _("Right")),
)

GRID_3_4_6_CHOICES = [
("3", "3/12"),
("4", "4/12"),
("6", "6/12"),
]

HEADING_CHOICES = [
("h2", _("Heading 2")),
("h3", _("Heading 3")),
Expand Down
Binary file modified content_manager/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 982b042

Please sign in to comment.