Skip to content

Commit

Permalink
Merge pull request #1419 from openeuropa/EWPP-4069
Browse files Browse the repository at this point in the history
EWPP-4069: Use vertical lists variant for all the teaser displays.
  • Loading branch information
22Alexandra authored Feb 28, 2024
2 parents 3aa578b + 7c7b4bf commit 87682bd
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'url': url,
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-call-tenders--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'url': url,
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-consultation--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'url': url,
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-event--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
'meta': content.extra_field_oe_theme_content_event_teaser_meta|field_value,
'detail': detail,
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-news--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'detail': detail,
'image': image_url ? { 'src': image_url },
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-organisation--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'detail': content.oe_teaser|field_value,
'lists': additional_information,
'lists_variant': 'vertical',
'image': image_url ? { 'src': image_url },
'badges': badges,
'external_link': external_link
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-page--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'detail': content.oe_teaser|field_value,
'lists': additional_information|default([]),
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-person--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
'title': label,
'detail': content.oe_teaser|field_value,
'lists': additional_information,
'lists_variant': 'vertical',
'image': content.portrait_image ? { 'src': content.portrait_image|render },
'badges': badges,
'external_link': external_link
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-policy--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'detail': content.oe_teaser|field_value,
'lists': additional_information|default([]),
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-project--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'title': content.extra_field_oe_theme_helper_short_title_with_fallback|field_value,
'detail': content.oe_teaser|field_value,
'lists': additional_information,
'lists_variant': 'vertical',
'image': image_url ? { 'src': image_url },
'badges': badges,
'external_link': external_link
Expand Down
1 change: 1 addition & 0 deletions templates/content/node--oe-publication--teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'detail': content.oe_teaser|field_value,
'image': image_url ? { 'src': image_url },
'lists': additional_information,
'lists_variant': 'vertical',
'badges': badges,
'external_link': external_link
}) }}
Expand Down
2 changes: 1 addition & 1 deletion templates/patterns/field_list/pattern-field-list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% if _items %}
{% block content %}
{% include '@ecl-twig/description-list' with {
'variant': variant,
'variant': variant|default('vertical'),
'items': _items,
'extra_classes': extra_classes,
} %}
Expand Down
5 changes: 5 additions & 0 deletions tests/src/Kernel/CallForProposalsRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public function testTeaser(): void {
'body' => 'Arab Common Market',
],
],
'variant' => 'vertical',
],
];
$assert->assertPattern($expected_values, $html);
Expand Down Expand Up @@ -174,6 +175,7 @@ public function testTeaser(): void {
'body' => 'Arab Common Market',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down Expand Up @@ -215,6 +217,7 @@ public function testTeaser(): void {
'body' => 'Arab Common Market',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down Expand Up @@ -255,6 +258,7 @@ public function testTeaser(): void {
'body' => 'Arab Common Market',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down Expand Up @@ -286,6 +290,7 @@ public function testTeaser(): void {
'body' => 'Arab Common Market',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/src/Kernel/CallForTendersRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function testTeaser(): void {
'body' => 'Audit Board of the European Communities, Arab Common Market',
],
],
'variant' => 'vertical',
],
];
$assert->assertPattern($expected_values, $html);
Expand Down Expand Up @@ -168,6 +169,7 @@ public function testTeaser(): void {
'body' => 'Audit Board of the European Communities',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down Expand Up @@ -203,6 +205,7 @@ public function testTeaser(): void {
'body' => 'Audit Board of the European Communities',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down Expand Up @@ -242,6 +245,7 @@ public function testTeaser(): void {
'body' => 'Audit Board of the European Communities',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down
3 changes: 3 additions & 0 deletions tests/src/Kernel/ConsultationRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function testTeaser(): void {
'body' => '21 February 2020, 01:00 (AEDT)',
],
],
'variant' => 'vertical',
],
];
$assert->assertPattern($expected_values, $html);
Expand Down Expand Up @@ -158,6 +159,7 @@ public function testTeaser(): void {
'body' => '17 February 2020, 12:00 (AEDT)',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand All @@ -184,6 +186,7 @@ public function testTeaser(): void {
'body' => '21 February 2020, 12:00 (AEDT)',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $html);

Expand Down
3 changes: 2 additions & 1 deletion tests/src/Kernel/OrganisationRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public function testOrganisationTeaser(): void {
'body' => 'Address first_contact, 1001 Brussels, Belgium',
],
],
'variant' => 'vertical',
],
];
$assert->assertPattern($expected_values, $html);
Expand Down Expand Up @@ -163,7 +164,7 @@ public function testOrganisationTeaser(): void {
$build = $this->nodeViewBuilder->view($node, 'teaser');
$html = $this->renderRoot($build);
$crawler = new Crawler($html);
$contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--horizontal.ecl-content-block__list');
$contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--vertical.ecl-content-block__list');
$this->assertCount(2, $contacts_render);

$field_assert = new FieldListAssert();
Expand Down
6 changes: 5 additions & 1 deletion tests/src/Kernel/PersonRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public function testTeaser(): void {
'body' => 'Audit Board of the European Communities',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $this->getRenderedNode($node));

Expand All @@ -151,6 +152,7 @@ public function testTeaser(): void {
'body' => 'Audit Board of the European Communities, Arab Common Market',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $this->getRenderedNode($node));

Expand Down Expand Up @@ -193,6 +195,7 @@ public function testTeaser(): void {
'body' => 'Social media direct_contact',
],
],
'variant' => 'vertical',
];
$assert->assertPattern($expected_values, $this->getRenderedNode($node));

Expand All @@ -206,7 +209,7 @@ public function testTeaser(): void {

$html = $this->getRenderedNode($node);
$crawler = new Crawler($html);
$contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--horizontal.ecl-content-block__list');
$contacts_render = $crawler->filter('article .ecl-content-block.ecl-content-item__content-block .ecl-description-list.ecl-description-list--vertical.ecl-content-block__list');
$this->assertCount(3, $contacts_render);

$field_assert = new FieldListAssert();
Expand Down Expand Up @@ -336,6 +339,7 @@ public function testTeaser(): void {
'body' => 'SingerDescription job_1DancerDescription job_2',
],
],
'variant' => 'vertical',
],
];
$html = $this->getRenderedNode($node);
Expand Down
1 change: 1 addition & 0 deletions tests/src/Kernel/ProjectRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public function testProjectTeaser(): void {
'body' => 'Belgium',
],
],
'variant' => 'vertical',
],
];
$assert->assertPattern($expected_values, $html);
Expand Down
12 changes: 6 additions & 6 deletions tests/src/PatternAssertions/FieldListAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ protected function getPatternVariant(string $html): string {
$field_list_container = $crawler->filter('dl.ecl-description-list');
$existing_classes = $field_list_container->attr('class');
$existing_classes = explode(' ', $existing_classes);
if (in_array('ecl-description-list--default', $existing_classes)) {
return 'default';
}
if (in_array('ecl-description-list--featured', $existing_classes)) {
return 'featured_horizontal';
}
return 'horizontal';
if (in_array('ecl-description-list--horizontal', $existing_classes)) {
return 'horizontal';
}
return 'vertical';
}

/**
Expand Down Expand Up @@ -93,10 +93,10 @@ protected function getBaseItemClass(string $variant): string {
return '.ecl-description-list--horizontal';

case 'featured_horizontal':
return '.ecl-description-list--horizontal.ecl-description-list--featured';
return '.ecl-description-list.ecl-description-list--horizontal.ecl-description-list--featured';

default:
return 'ecl-description-list--default';
return '.ecl-description-list--vertical';
}
}

Expand Down

0 comments on commit 87682bd

Please sign in to comment.