Skip to content

Commit

Permalink
CDD:2194: remove headline number from simplified chart component
Browse files Browse the repository at this point in the history
  • Loading branch information
phill-stanley committed Sep 13, 2024
1 parent 4ae850a commit 1cb4223
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
7 changes: 7 additions & 0 deletions cms/dynamic_content/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
MAXIMUM_ROWS_NUMBER_BLOCK_COUNT: int = 2


class TrendNumberBlockType(blocks.StreamBlock):
trend_number = TrendNumberComponent(help_text=help_texts.TREND_BLOCK_FIELD)

class Meta:
icon = "trend_down"


class HeadlineNumberBlockTypes(blocks.StreamBlock):
headline_number = HeadlineNumberComponent(help_text=help_texts.HEADLINE_BLOCK_FIELD)
trend_number = TrendNumberComponent(help_text=help_texts.TREND_BLOCK_FIELD)
Expand Down
22 changes: 12 additions & 10 deletions cms/dynamic_content/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

from cms.common.models import AVAILABLE_RICH_TEXT_FEATURES
from cms.dynamic_content import help_texts
from cms.dynamic_content.blocks import HeadlineNumberBlockTypes, MetricNumberBlock
from cms.dynamic_content.blocks import (
HeadlineNumberBlockTypes,
MetricNumberBlock,
TrendNumberBlockType,
)
from cms.dynamic_content.components import (
ChartComponent,
HeadlineChartComponent,
Expand Down Expand Up @@ -30,6 +34,7 @@ class Meta:
MAXIMUM_COLUMNS_CHART_COLUMNS_COUNT: int = 2

MAXIMUM_TOPIC_TREND_CARD_CHARTS: int = 1
MAXIMUM_TREND_NUMBER: int = 1

DEFAULT_SIMPLE_CHART_X_AXIS = "date"
DEFAULT_SIMPLE_CHART_Y_AXIS = "metric"
Expand Down Expand Up @@ -80,7 +85,7 @@ class Meta:
icon = "chart_with_headline_and_trend_card"


class TropicTrendWithHeadlineAndLink(blocks.StructBlock):
class TropicTrendChartAndLink(blocks.StructBlock):
title = blocks.TextBlock(required=True, help_text=help_texts.TITLE_FIELD)
body = blocks.TextBlock(required=False, help_text=help_texts.OPTIONAL_BODY_FIELD)
tag_manager_event_id = blocks.CharBlock(
Expand Down Expand Up @@ -111,13 +116,10 @@ class TropicTrendWithHeadlineAndLink(blocks.StructBlock):
required=True,
max_num=MAXIMUM_TOPIC_TREND_CARD_CHARTS,
)
headline_number_columns = HeadlineNumberBlockTypes(
required=False,
min_num=MINIMUM_HEADLINES_IN_CHART_CARD_COLUMN_COUNT,
max_num=MAXIMUM_HEADLINES_IN_CHART_CARD_COLUMN_COUNT,
help_text=help_texts.HEADLINE_COLUMNS_IN_CHART_CARD.format(
MAXIMUM_HEADLINES_IN_CHART_CARD_COLUMN_COUNT
),
trend_number = TrendNumberBlockType(
required=True,
max_num=MAXIMUM_TREND_NUMBER,
help_text=help_texts.TREND_BLOCK_FIELD,
)

class Meta:
Expand Down Expand Up @@ -164,7 +166,7 @@ class ChartRowBlockTypes(blocks.StreamBlock):
chart_card = ChartCard()
headline_chart_card = HeadlineChartCard()
chart_with_headline_and_trend_card = ChartWithHeadlineAndTrendCard()
topic_trend_with_headline_number = TropicTrendWithHeadlineAndLink()
topic_trend_chart_and_link = TropicTrendChartAndLink()


class ChartRowCard(blocks.StructBlock):
Expand Down

0 comments on commit 1cb4223

Please sign in to comment.