|
13 | 13 | MetricNumberBlock, |
14 | 14 | PageLinkChooserBlock, |
15 | 15 | RelatedLinkBlock, |
| 16 | + SourceLinkBlock, |
16 | 17 | ) |
17 | 18 | from cms.dynamic_content.components import ( |
18 | 19 | ChartComponent, |
@@ -76,11 +77,19 @@ def get_alerts(cls) -> tuple[tuple[str, str]]: |
76 | 77 | class WeatherHealthAlertsCard(blocks.StructBlock): |
77 | 78 | title = blocks.TextBlock(required=True, help_text=help_texts.TITLE_FIELD) |
78 | 79 | sub_title = blocks.TextBlock(required=True, help_text=help_texts.SUB_TITLE_FIELD) |
| 80 | + description = blocks.TextBlock( |
| 81 | + required=False, |
| 82 | + help_text=help_texts.WEATHER_HEALTH_ALERT_DESCRIPTION, |
| 83 | + ) |
79 | 84 | alert_type = blocks.ChoiceBlock( |
80 | 85 | required=True, |
81 | 86 | choices=WHAlerts.get_alerts, |
82 | 87 | help_text=help_texts.WHA_ALERT_CHOICE, |
83 | 88 | ) |
| 89 | + source = SourceLinkBlock( |
| 90 | + required=False, |
| 91 | + help_text=help_texts.SOURCE_LINK, |
| 92 | + ) |
84 | 93 |
|
85 | 94 | class Meta: |
86 | 95 | icon = "weather" |
@@ -295,6 +304,20 @@ class Meta: |
295 | 304 | icon = "standalone_chart" |
296 | 305 |
|
297 | 306 |
|
| 307 | +class ChartWithDescriptionCard(ChartCard): |
| 308 | + description = blocks.TextBlock( |
| 309 | + required=True, |
| 310 | + help_text=help_texts.CHART_DESCRIPTION, |
| 311 | + ) |
| 312 | + source = SourceLinkBlock( |
| 313 | + required=False, |
| 314 | + help_text=help_texts.SOURCE_LINK_INTERNAL_OR_EXTERNAL, |
| 315 | + ) |
| 316 | + |
| 317 | + class Meta: |
| 318 | + icon = "standalone_chart" |
| 319 | + |
| 320 | + |
298 | 321 | class HeadlineChartCard(ChartCard): |
299 | 322 | x_axis = blocks.ChoiceBlock( |
300 | 323 | required=True, |
@@ -338,6 +361,20 @@ class Meta: |
338 | 361 | icon = "standalone_chart" |
339 | 362 |
|
340 | 363 |
|
| 364 | +class HeadlineChartWithDescriptionCard(HeadlineChartCard): |
| 365 | + description = blocks.TextBlock( |
| 366 | + required=True, |
| 367 | + help_text=help_texts.HEADLINE_CHART_DESCRIPTION, |
| 368 | + ) |
| 369 | + source = SourceLinkBlock( |
| 370 | + required=False, |
| 371 | + help_text=help_texts.SOURCE_LINK_INTERNAL_OR_EXTERNAL, |
| 372 | + ) |
| 373 | + |
| 374 | + class Meta: |
| 375 | + icon = "standalone_chart" |
| 376 | + |
| 377 | + |
341 | 378 | class DualCategoryChartCard(blocks.StructBlock): |
342 | 379 | title = blocks.TextBlock(required=True, help_text=help_texts.TITLE_FIELD) |
343 | 380 | body = blocks.TextBlock( |
@@ -445,7 +482,9 @@ def media(self): |
445 | 482 |
|
446 | 483 | class ChartRowBlockTypes(blocks.StreamBlock): |
447 | 484 | chart_card = ChartCard() |
| 485 | + chart_with_description_card = ChartWithDescriptionCard() |
448 | 486 | headline_chart_card = HeadlineChartCard() |
| 487 | + headline_chart_with_description_card = HeadlineChartWithDescriptionCard() |
449 | 488 | chart_with_headline_and_trend_card = ChartWithHeadlineAndTrendCard() |
450 | 489 | simplified_chart_with_link = SimplifiedChartWithLink() |
451 | 490 | dual_category_chart_card = DualCategoryChartCard() |
|
0 commit comments