From b7bdcb48f5a0299e8189cc6147afc375fd026812 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Wed, 20 Oct 2021 10:32:21 +0100 Subject: [PATCH 01/17] =?UTF-8?q?ISAICP-6765:=20=E2=80=9CHighlighted=20Sol?= =?UTF-8?q?ution=E2=80=9D=20will=20become=20=E2=80=9CHighlighted=20Content?= =?UTF-8?q?=E2=80=9D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...play.rdf_entity.collection.highlighted.yml | 148 ++++++++++++++++++ ...ueue.entity_queue.highlighted_solution.yml | 3 +- ...page_variant.homepage-layout_builder-0.yml | 2 +- tests/behat.yml.dist | 2 +- tests/features/homepage.feature | 4 +- .../curated_content_listings.feature | 12 +- tests/src/Context/SolutionContext.php | 18 +-- ...ueue-block--highlighted-solution.html.twig | 2 +- ...-entity--collection--highlighted.html.twig | 18 +++ web/themes/ventuno/ventuno.theme | 31 ++++ 10 files changed, 219 insertions(+), 21 deletions(-) create mode 100644 config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml create mode 100644 web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig diff --git a/config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml b/config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml new file mode 100644 index 0000000000..ab1bdc1e71 --- /dev/null +++ b/config/sync/core.entity_view_display.rdf_entity.collection.highlighted.yml @@ -0,0 +1,148 @@ +uuid: 651f0d88-0d69-41c1-a40c-908655d164bc +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.rdf_entity.highlighted + - field.field.rdf_entity.collection.field_ar_abstract + - field.field.rdf_entity.collection.field_ar_access_url + - field.field.rdf_entity.collection.field_ar_affiliates + - field.field.rdf_entity.collection.field_ar_banner + - field.field.rdf_entity.collection.field_ar_closed + - field.field.rdf_entity.collection.field_ar_contact_information + - field.field.rdf_entity.collection.field_ar_content_creation + - field.field.rdf_entity.collection.field_ar_description + - field.field.rdf_entity.collection.field_ar_logo + - field.field.rdf_entity.collection.field_ar_moderation + - field.field.rdf_entity.collection.field_ar_owner + - field.field.rdf_entity.collection.field_ar_state + - field.field.rdf_entity.collection.field_collection_content + - field.field.rdf_entity.collection.field_keywords + - field.field.rdf_entity.collection.field_newsletter + - field.field.rdf_entity.collection.field_short_id + - field.field.rdf_entity.collection.field_site_featured + - field.field.rdf_entity.collection.field_spatial_coverage + - field.field.rdf_entity.collection.field_topic + - rdf_entity.rdfentity.collection + - responsive_image.styles.highlighted_solution + module: + - field_delimiter + - field_formatter_range + - field_group + - layout_builder + - responsive_image + - smart_trim + - template_suggestion + - user +third_party_settings: + field_group: + group_abstract_wrapper: + children: + - field_ar_abstract + - read_more + parent_name: '' + weight: 4 + format_type: html_element + format_settings: + element: div + show_label: false + label_element: h3 + attributes: '' + effect: none + speed: fast + id: '' + classes: '' + label: 'Abstract wrapper' + region: hidden + layout_builder: + allow_custom: false + enabled: false +id: rdf_entity.collection.highlighted +targetEntityType: rdf_entity +bundle: collection +mode: highlighted +content: + field_ar_description: + type: smart_trim + weight: 3 + region: content + label: hidden + settings: + trim_length: 200 + trim_type: chars + trim_suffix: … + wrap_class: trimmed + more_text: More + more_class: more-link + trim_options: + text: true + trim_zero: false + wrap_output: false + more_link: false + summary_handler: full + third_party_settings: + template_suggestion: + template_suggestion: '' + field_ar_logo: + type: responsive_image + weight: 0 + region: content + label: hidden + settings: + responsive_image_style: highlighted_solution + image_link: content + third_party_settings: + template_suggestion: + template_suggestion: '' + field_topic: + type: entity_reference_label + weight: 1 + region: content + label: hidden + settings: + link: true + third_party_settings: + field_delimiter: + delimiter: '' + field_formatter_range: + order: 0 + limit: 2 + offset: 0 + template_suggestion: + template_suggestion: '' + label: + label: hidden + type: string + weight: 2 + settings: + link_to_entity: false + third_party_settings: { } + region: content +hidden: + changed: true + created: true + field_ar_abstract: true + field_ar_access_url: true + field_ar_affiliates: true + field_ar_banner: true + field_ar_closed: true + field_ar_contact_information: true + field_ar_content_creation: true + field_ar_moderation: true + field_ar_owner: true + field_ar_state: true + field_collection_content: true + field_keywords: true + field_newsletter: true + field_short_id: true + field_site_featured: true + field_spatial_coverage: true + join_collection: true + langcode: true + last_update: true + members: true + og_group: true + rdf_entity_field_collection_content_inline_facets: true + rdf_entity_field_collection_content_top: true + read_more: true + solutions: true diff --git a/config/sync/entityqueue.entity_queue.highlighted_solution.yml b/config/sync/entityqueue.entity_queue.highlighted_solution.yml index 3b3a5d60f6..2a3d23b081 100644 --- a/config/sync/entityqueue.entity_queue.highlighted_solution.yml +++ b/config/sync/entityqueue.entity_queue.highlighted_solution.yml @@ -5,7 +5,7 @@ dependencies: module: - rdf_entity id: highlighted_solution -label: 'Highlighted solution' +label: 'Highlighted content' handler: simple handler_configuration: { } entity_settings: @@ -13,6 +13,7 @@ entity_settings: handler: 'default:rdf_entity' handler_settings: target_bundles: + collection: collection solution: solution sort: field: _none diff --git a/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml b/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml index 4a422cc7f2..39b2ffe9c7 100644 --- a/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml +++ b/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml @@ -36,7 +36,7 @@ variant_settings: region: second configuration: id: 'entityqueue_block:highlighted_solution' - label: 'Highlighted solution' + label: 'Highlighted content' provider: entityqueue_block label_display: visible view_mode: highlighted diff --git a/tests/behat.yml.dist b/tests/behat.yml.dist index edaab95926..3f3d20e746 100644 --- a/tests/behat.yml.dist +++ b/tests/behat.yml.dist @@ -113,7 +113,7 @@ default: Header menu: '#block-joinup-theme-main-menu' Header: '.section--featured, .section-header' Highlighted event: '.block-entityqueue--highlighted-event' - Highlighted solution: '.block-entityqueue--highlighted-solution' + Highlighted content: '.block-entityqueue--highlighted-solution' In the spotlight: '.block-views-blockin-the-spotlight-block' Left sidebar: '.section--sidebar-left' Main solution vertical tab: '#edit-group-main' diff --git a/tests/features/homepage.feature b/tests/features/homepage.feature index a489c49ee2..b97dc74512 100644 --- a/tests/features/homepage.feature +++ b/tests/features/homepage.feature @@ -99,12 +99,12 @@ Feature: Homepage | solution type | Interoperability Specification, Networking Service | | topic | Demography, EU and European Policies, HR | | state | validated | - And the "Highlighted solution" content listing contains: + And the "Highlighted content" content listing contains: | type | label | | solution | Mercury poisoning | When I am on the homepage - Then I should see "Mercury poisoning" as the highlighted solution + Then I should see "Mercury poisoning" as the Highlighted content And I should see the link "More solutions" When I click "More solutions" Then I should be on the advanced search page diff --git a/tests/features/moderator/curated_content_listings.feature b/tests/features/moderator/curated_content_listings.feature index 15fdf64faf..4049d76319 100644 --- a/tests/features/moderator/curated_content_listings.feature +++ b/tests/features/moderator/curated_content_listings.feature @@ -12,7 +12,7 @@ Feature: Curated content listings And I should see the following links: | Discover topics | | Highlighted event | - | Highlighted solution | + | Highlighted content | | In the spotlight | When I click "Discover topics" Then I should see the heading "Update curated content listing Discover topics" @@ -27,19 +27,19 @@ Feature: Curated content listings And I am on the homepage Then I should not see any contextual links in the "In the spotlight" region And I should not see any contextual links in the "Highlighted event" region - And I should not see any contextual links in the "Highlighted solution" region + And I should not see any contextual links in the "Highlighted content" region Given I am logged in as an "authenticated user" And I am on the homepage Then I should not see any contextual links in the "In the spotlight" region And I should not see any contextual links in the "Highlighted event" region - And I should not see any contextual links in the "Highlighted solution" region + And I should not see any contextual links in the "Highlighted content" region Given I am logged in as a "moderator" And I am on the homepage Then I should see the contextual link "Update curated content" in the "In the spotlight" region And I should see the contextual link "Update curated content" in the "Highlighted event" region - And I should see the contextual link "Update curated content" in the "Highlighted solution" region + And I should see the contextual link "Update curated content" in the "Highlighted content" region Given I am on the homepage When I click the contextual link "Update curated content" in the "In the spotlight" region @@ -50,5 +50,5 @@ Feature: Curated content listings Then I should see the heading "Update curated content listing Highlighted event" Given I am on the homepage - When I click the contextual link "Update curated content" in the "Highlighted solution" region - Then I should see the heading "Update curated content listing Highlighted solution" + When I click the contextual link "Update curated content" in the "Highlighted content" region + Then I should see the heading "Update curated content listing Highlighted content" diff --git a/tests/src/Context/SolutionContext.php b/tests/src/Context/SolutionContext.php index d5da167644..e026ed1d42 100644 --- a/tests/src/Context/SolutionContext.php +++ b/tests/src/Context/SolutionContext.php @@ -847,34 +847,34 @@ public function setDownloadCountForEntity(string $type, string $target_entity_la } /** - * Checks the contents of the "Highlighted solution" block. + * Checks the contents of the "Highlighted content" block. * * This is shown on the homepage. * * @param string $label * The label of the solution that is highlighted on the homepage. * - * @Then I should see :label as the highlighted solution + * @Then I should see :label as the Highlighted content */ public function assertHighlightedSolution(string $label): void { $solution = self::getSolutionByName($label); - $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-solution'); + $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-content'); // Check block title. $actual_block_title = $block_element->find('css', 'h2')->getText(); - Assert::assertEquals('Highlighted solution', $actual_block_title, sprintf('Expected the highlighted solution block to have the title "Highlighted solution" but instead found "%s".', $actual_block_title)); + Assert::assertEquals('Highlighted content', $actual_block_title, sprintf('Expected the Highlighted content block to have the title "Highlighted content" but instead found "%s".', $actual_block_title)); // Check that the logo is present. if ($logo = $solution->getLogoAsFile()) { $filename = $logo->getFilename(); $logo_is_present = self::hasImage($filename, $block_element); - Assert::assertTrue($logo_is_present, sprintf('Image with filename "%s" has been found in the highlighted solution block.', $filename)); + Assert::assertTrue($logo_is_present, sprintf('Image with filename "%s" has been found in the Highlighted content block.', $filename)); } // Check title text. $actual_title = $block_element->find('css', 'article h2')->getText(); - Assert::assertEquals($solution->label(), $actual_title, sprintf('Expected the highlighted solution to have the title "%s" but instead found "%s".', $solution->label(), $actual_title)); + Assert::assertEquals($solution->label(), $actual_title, sprintf('Expected the Highlighted content to have the title "%s" but instead found "%s".', $solution->label(), $actual_title)); // Check that title links to the canonical page of the solution. $xpath = '//h2/a[@href = "' . $solution->toUrl()->toString() . '"]'; @@ -886,7 +886,7 @@ public function assertHighlightedSolution(string $label): void { // Check that the correct number of topics are present. $topic_elements = $block_element->findAll('css', '.field--name-field-topic .field__item'); - Assert::assertEquals(count($topics), count($topic_elements), sprintf('Expected %d topics in the "Highlighted solution" section but found %d topics.', count($topics), count($topic_elements))); + Assert::assertEquals(count($topics), count($topic_elements), sprintf('Expected %d topics in the "Highlighted content" section but found %d topics.', count($topics), count($topic_elements))); foreach ($topics as $j => $topic) { /** @var \Behat\Mink\Element\NodeElement $topic_element */ @@ -894,11 +894,11 @@ public function assertHighlightedSolution(string $label): void { // Check the title of each topic. $actual_topic_title = $topic_element->getText(); - Assert::assertEquals($topic->label(), $actual_topic_title, sprintf('Expected topic #%d to be "%s" in the "Highlighted solution" section but instead found "%s".', $j + 1, $topic->label(), $actual_topic_title)); + Assert::assertEquals($topic->label(), $actual_topic_title, sprintf('Expected topic #%d to be "%s" in the "Highlighted content" section but instead found "%s".', $j + 1, $topic->label(), $actual_topic_title)); // Check that each topic links to their canonical page. $xpath = '/a[@href = "' . $topic->toUrl()->toString() . '"]'; - Assert::assertNotEmpty($topic_element->find('xpath', $xpath), sprintf('Topic "%s" in the "Highlighted solution" section does not link to the canonical topic page.', $actual_topic_title)); + Assert::assertNotEmpty($topic_element->find('xpath', $xpath), sprintf('Topic "%s" in the "Highlighted content" section does not link to the canonical topic page.', $actual_topic_title)); } // Check that the description is present. diff --git a/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig b/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig index 2ecd30c2e2..7a1557127e 100644 --- a/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig +++ b/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig @@ -41,7 +41,7 @@ {% endif %} {{ title_suffix }} {% block content %} - {{ 'More solutions'|t }} + {{ related_content }} {{ content }} {% endblock %} diff --git a/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig b/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig new file mode 100644 index 0000000000..fbf1ed495b --- /dev/null +++ b/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig @@ -0,0 +1,18 @@ +{# +/** + * @file + * Themeing for rdf entities. + */ +#} + + {{ content.field_ar_logo }} + {{ content.field_topic }} + {{ title_prefix }} + {% if not page and not is_label_hidden %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + {{ content|without('field_ar_logo', 'field_topic') }} + diff --git a/web/themes/ventuno/ventuno.theme b/web/themes/ventuno/ventuno.theme index 9728db6ac0..9c4bd88093 100644 --- a/web/themes/ventuno/ventuno.theme +++ b/web/themes/ventuno/ventuno.theme @@ -138,6 +138,37 @@ function ventuno_preprocess_page(&$variables) { $variables['anonymous_links'] = $anonymous_links; } +/** + * Implements hook_preprocess_block(). + */ +function ventuno_preprocess_block(&$variables) { + if ($variables['derivative_plugin_id'] == 'highlighted_solution') { + /** @var \Drupal\rdf_entity\RdfInterface $entity */ + $entity = $variables['elements']['content']['entities'][0]['#rdf_entity']; + + $topics = $entity->get('field_topic')->getValue(); + + $options = [ + 'query' => + [ + 'f' => + [ + 'type:' . $entity->bundle(), + 'topic:' . reset($topics)["target_id"], + ], + ], + ]; + $variables['related_content'] = [ + '#type' => 'link', + '#title' => t('Related content'), + '#url' => Url::fromRoute('view.search.page_1', [], $options), + '#attributes' => [ + 'class' => ['more-link'], + ], + ]; + } +} + /** * Implements hook_preprocess_HOOK(). * From c31c06e221e9fd850abecd195b68d90f4e8594f4 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Wed, 20 Oct 2021 14:19:24 +0100 Subject: [PATCH 02/17] ISAICP-6765: Fix class block_element higlight content. --- tests/src/Context/SolutionContext.php | 2 +- web/themes/ventuno/ventuno.theme | 40 ++++++++++++++------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/src/Context/SolutionContext.php b/tests/src/Context/SolutionContext.php index e026ed1d42..ce7e778b56 100644 --- a/tests/src/Context/SolutionContext.php +++ b/tests/src/Context/SolutionContext.php @@ -859,7 +859,7 @@ public function setDownloadCountForEntity(string $type, string $target_entity_la public function assertHighlightedSolution(string $label): void { $solution = self::getSolutionByName($label); - $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-content'); + $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-solution'); // Check block title. $actual_block_title = $block_element->find('css', 'h2')->getText(); diff --git a/web/themes/ventuno/ventuno.theme b/web/themes/ventuno/ventuno.theme index 9c4bd88093..48668ac35f 100644 --- a/web/themes/ventuno/ventuno.theme +++ b/web/themes/ventuno/ventuno.theme @@ -143,29 +143,31 @@ function ventuno_preprocess_page(&$variables) { */ function ventuno_preprocess_block(&$variables) { if ($variables['derivative_plugin_id'] == 'highlighted_solution') { - /** @var \Drupal\rdf_entity\RdfInterface $entity */ - $entity = $variables['elements']['content']['entities'][0]['#rdf_entity']; + if (isset($variables['elements']['content']['entities'][0])) { + /** @var \Drupal\rdf_entity\RdfInterface $entity */ + $entity = $variables['elements']['content']['entities'][0]['#rdf_entity']; - $topics = $entity->get('field_topic')->getValue(); + $topics = $entity->get('field_topic')->getValue(); - $options = [ - 'query' => - [ - 'f' => + $options = [ + 'query' => [ - 'type:' . $entity->bundle(), - 'topic:' . reset($topics)["target_id"], + 'f' => + [ + 'type:' . $entity->bundle(), + 'topic:' . reset($topics)["target_id"], + ], ], - ], - ]; - $variables['related_content'] = [ - '#type' => 'link', - '#title' => t('Related content'), - '#url' => Url::fromRoute('view.search.page_1', [], $options), - '#attributes' => [ - 'class' => ['more-link'], - ], - ]; + ]; + $variables['related_content'] = [ + '#type' => 'link', + '#title' => t('Related content'), + '#url' => Url::fromRoute('view.search.page_1', [], $options), + '#attributes' => [ + 'class' => ['more-link'], + ], + ]; + } } } From bbe23c6ebc495a94bc294692d3f6f16a3fd4dc9d Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Wed, 20 Oct 2021 18:33:09 +0100 Subject: [PATCH 03/17] ISAICP-6765: Fix click More solutions to Related content. --- tests/features/homepage.feature | 4 ++-- tests/features/joinup_core/social_share.feature | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/features/homepage.feature b/tests/features/homepage.feature index b97dc74512..967b3f3c2a 100644 --- a/tests/features/homepage.feature +++ b/tests/features/homepage.feature @@ -105,8 +105,8 @@ Feature: Homepage When I am on the homepage Then I should see "Mercury poisoning" as the Highlighted content - And I should see the link "More solutions" - When I click "More solutions" + And I should see the link "Related content" + When I click "Related content" Then I should be on the advanced search page And the "Solution" content checkbox item should be selected diff --git a/tests/features/joinup_core/social_share.feature b/tests/features/joinup_core/social_share.feature index d55f3f4e24..74df3d4dbc 100644 --- a/tests/features/joinup_core/social_share.feature +++ b/tests/features/joinup_core/social_share.feature @@ -39,8 +39,7 @@ Feature: Sharing content on social networks | Important solution | Social networks | validated | When I am logged in as a user with the "authenticated" role - And I am on the homepage - And I click "More solutions" + And I visit the search page And I click the contextual link "Share" in the "Important solution" tile And I should see the link "Facebook" From dcf530cdcd8f199121e22d9a9266882d7ead45a3 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Thu, 21 Oct 2021 20:41:27 +0100 Subject: [PATCH 04/17] ISAICP-6765: Fix highlighted view modes. --- ...view_display.node.document.highlighted.yml | 137 ++++++++++++++++++ ...ty_view_display.node.event.highlighted.yml | 59 ++++++-- ...w_display.node.event.highlighted_event.yml | 86 +++++++++++ ...ity_view_display.node.news.highlighted.yml | 124 ++++++++++++++++ ...ntity_view_mode.node.highlighted_event.yml | 10 ++ ...ueue.entity_queue.highlighted_content.yml} | 17 ++- ...page_variant.homepage-layout_builder-0.yml | 10 +- tests/behat.yml.dist | 2 +- tests/features/homepage.feature | 73 ++++++++-- tests/src/Context/SolutionContext.php | 19 +-- .../custom/joinup_event/joinup_event.module | 8 +- ... node--event--highlighted-event.html.twig} | 0 ...k.scss => _highlighted-content-block.scss} | 6 +- .../src/scss/components/_homepage.scss | 2 +- web/themes/ventuno/src/scss/homepage.scss | 2 +- ...ueue-block--highlighted-content.html.twig} | 0 .../node--document--highlighted.html.twig | 18 +++ .../node--event--highlighted.html.twig | 18 +++ .../node--news--highlighted.html.twig} | 6 +- web/themes/ventuno/ventuno.theme | 11 +- 20 files changed, 543 insertions(+), 65 deletions(-) create mode 100644 config/sync/core.entity_view_display.node.document.highlighted.yml create mode 100644 config/sync/core.entity_view_display.node.event.highlighted_event.yml create mode 100644 config/sync/core.entity_view_display.node.news.highlighted.yml create mode 100644 config/sync/core.entity_view_mode.node.highlighted_event.yml rename config/sync/{entityqueue.entity_queue.highlighted_solution.yml => entityqueue.entity_queue.highlighted_content.yml} (58%) rename web/modules/custom/joinup_event/templates/{node--event--highlighted.html.twig => node--event--highlighted-event.html.twig} (100%) rename web/themes/ventuno/src/scss/components/{_highlighted-solution-block.scss => _highlighted-content-block.scss} (92%) rename web/themes/ventuno/templates/block/{block--entityqueue-block--highlighted-solution.html.twig => block--entityqueue-block--highlighted-content.html.twig} (100%) create mode 100644 web/themes/ventuno/templates/content/node--document--highlighted.html.twig create mode 100644 web/themes/ventuno/templates/content/node--event--highlighted.html.twig rename web/themes/ventuno/templates/{rdf-entity/rdf-entity--collection--highlighted.html.twig => content/node--news--highlighted.html.twig} (68%) diff --git a/config/sync/core.entity_view_display.node.document.highlighted.yml b/config/sync/core.entity_view_display.node.document.highlighted.yml new file mode 100644 index 0000000000..f81fd9db23 --- /dev/null +++ b/config/sync/core.entity_view_display.node.document.highlighted.yml @@ -0,0 +1,137 @@ +uuid: 5fbb7f17-0be8-4c70-8a5c-ceb806015a8f +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.highlighted + - field.field.node.document.body + - field.field.node.document.field_comments + - field.field.node.document.field_document_logo + - field.field.node.document.field_document_publication_date + - field.field.node.document.field_document_spatial_coverage + - field.field.node.document.field_file + - field.field.node.document.field_keywords + - field.field.node.document.field_licence + - field.field.node.document.field_shared_in + - field.field.node.document.field_short_title + - field.field.node.document.field_site_featured + - field.field.node.document.field_state + - field.field.node.document.field_topic + - field.field.node.document.field_type + - field.field.node.document.og_audience + - node.type.document + - responsive_image.styles.highlighted_solution + module: + - field_delimiter + - field_formatter_range + - field_group + - layout_builder + - responsive_image + - template_suggestion + - text + - user +third_party_settings: + field_group: + group_categorisation: + children: + - field_short_title + - field_type + - field_document_publication_date + - field_licence + parent_name: '' + weight: 5 + format_type: html_element + format_settings: + id: '' + classes: '' + element: div + show_label: true + label_element: h3 + attributes: '' + effect: none + speed: fast + label: Categorisation + region: hidden + group_attachment: + children: + - field_file + parent_name: '' + weight: 7 + format_type: html_element + format_settings: + id: '' + classes: '' + element: div + show_label: true + label_element: h3 + attributes: '' + effect: none + speed: fast + label: Attachment + region: hidden + layout_builder: + allow_custom: false + enabled: false +_core: + default_config_hash: IBVftmfYLkfapLokxuyLrv1me4toJj5yidZu0ixGxQM +id: node.document.highlighted +targetEntityType: node +bundle: document +mode: highlighted +content: + body: + label: hidden + type: text_trimmed + weight: 2 + settings: + trim_length: 200 + third_party_settings: + template_suggestion: + template_suggestion: '' + region: content + field_document_logo: + type: responsive_image + weight: 0 + region: content + label: hidden + settings: + responsive_image_style: highlighted_solution + image_link: '' + third_party_settings: + template_suggestion: + template_suggestion: '' + field_topic: + type: entity_reference_label + weight: 1 + region: content + label: hidden + settings: + link: true + third_party_settings: + field_delimiter: + delimiter: '' + field_formatter_range: + order: 0 + limit: 2 + offset: 0 + template_suggestion: + template_suggestion: '' +hidden: + field_comments: true + field_document_publication_date: true + field_document_spatial_coverage: true + field_file: true + field_keywords: true + field_licence: true + field_shared_in: true + field_short_title: true + field_site_featured: true + field_state: true + field_type: true + langcode: true + links: true + og_audience: true + published_at: true + read_more: true + report: true + share_link: true diff --git a/config/sync/core.entity_view_display.node.event.highlighted.yml b/config/sync/core.entity_view_display.node.event.highlighted.yml index f6d4961202..29c176c20b 100644 --- a/config/sync/core.entity_view_display.node.event.highlighted.yml +++ b/config/sync/core.entity_view_display.node.event.highlighted.yml @@ -27,9 +27,13 @@ dependencies: - field.field.node.event.field_topic - field.field.node.event.og_audience - node.type.event + - responsive_image.styles.highlighted_solution module: - - joinup_core + - field_delimiter + - field_formatter_range - layout_builder + - responsive_image + - smart_trim - template_suggestion - user third_party_settings: @@ -41,29 +45,61 @@ targetEntityType: node bundle: event mode: highlighted content: - field_event_date: + body: + type: smart_trim + weight: 2 + region: content + label: hidden + settings: + trim_length: 200 + trim_type: chars + trim_suffix: '' + wrap_class: trimmed + more_text: More + more_class: more-link + summary_handler: full + wrap_output: false + more_link: false + trim_options: + text: false + trim_zero: false + third_party_settings: + template_suggestion: + template_suggestion: '' + field_event_logo: + type: responsive_image weight: 0 + region: content label: hidden settings: - timezone_override: '' - separator: to - default_format: d/m/Y - day_diff_format: d - month_diff_format: d/m - year_diff_format: d/m/Y + responsive_image_style: highlighted_solution + image_link: '' third_party_settings: template_suggestion: template_suggestion: '' - type: daterange_condensed + field_topic: + type: entity_reference_label + weight: 1 region: content + label: hidden + settings: + link: true + third_party_settings: + field_delimiter: + delimiter: '' + field_formatter_range: + order: 0 + limit: 2 + offset: 0 + template_suggestion: + template_suggestion: '' hidden: - body: true field_attachment: true field_comments: true field_event_agenda: true field_event_contact_email: true field_event_coordinates: true - field_event_logo: true + field_event_date: true field_event_online_location: true field_event_spatial_coverage: true field_event_web_url: true @@ -76,7 +112,6 @@ hidden: field_short_title: true field_site_featured: true field_state: true - field_topic: true langcode: true links: true og_audience: true diff --git a/config/sync/core.entity_view_display.node.event.highlighted_event.yml b/config/sync/core.entity_view_display.node.event.highlighted_event.yml new file mode 100644 index 0000000000..dfd008cb06 --- /dev/null +++ b/config/sync/core.entity_view_display.node.event.highlighted_event.yml @@ -0,0 +1,86 @@ +uuid: c8a8b7b3-2996-4276-81e9-f8ca6a274733 +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.highlighted_event + - field.field.node.event.body + - field.field.node.event.field_attachment + - field.field.node.event.field_comments + - field.field.node.event.field_event_agenda + - field.field.node.event.field_event_contact_email + - field.field.node.event.field_event_coordinates + - field.field.node.event.field_event_date + - field.field.node.event.field_event_logo + - field.field.node.event.field_event_online_location + - field.field.node.event.field_event_spatial_coverage + - field.field.node.event.field_event_web_url + - field.field.node.event.field_keywords + - field.field.node.event.field_location + - field.field.node.event.field_organisation + - field.field.node.event.field_organisation_type + - field.field.node.event.field_scope + - field.field.node.event.field_shared_in + - field.field.node.event.field_short_title + - field.field.node.event.field_site_featured + - field.field.node.event.field_state + - field.field.node.event.field_topic + - field.field.node.event.og_audience + - node.type.event + module: + - joinup_core + - layout_builder + - template_suggestion + - user +third_party_settings: + layout_builder: + allow_custom: false + enabled: false +id: node.event.highlighted_event +targetEntityType: node +bundle: event +mode: highlighted_event +content: + field_event_date: + weight: 0 + label: hidden + settings: + timezone_override: '' + separator: to + default_format: d/m/Y + day_diff_format: d + month_diff_format: d/m + year_diff_format: d/m/Y + third_party_settings: + template_suggestion: + template_suggestion: '' + type: daterange_condensed + region: content +hidden: + body: true + field_attachment: true + field_comments: true + field_event_agenda: true + field_event_contact_email: true + field_event_coordinates: true + field_event_logo: true + field_event_online_location: true + field_event_spatial_coverage: true + field_event_web_url: true + field_keywords: true + field_location: true + field_organisation: true + field_organisation_type: true + field_scope: true + field_shared_in: true + field_short_title: true + field_site_featured: true + field_state: true + field_topic: true + langcode: true + links: true + og_audience: true + published_at: true + read_more: true + report: true + share_link: true diff --git a/config/sync/core.entity_view_display.node.news.highlighted.yml b/config/sync/core.entity_view_display.node.news.highlighted.yml new file mode 100644 index 0000000000..43a918bb58 --- /dev/null +++ b/config/sync/core.entity_view_display.node.news.highlighted.yml @@ -0,0 +1,124 @@ +uuid: 31b72862-7d67-46f5-8bb4-798fe4a2818c +langcode: en +status: true +dependencies: + config: + - core.entity_view_mode.node.highlighted + - field.field.node.news.body + - field.field.node.news.field_attachment + - field.field.node.news.field_comments + - field.field.node.news.field_keywords + - field.field.node.news.field_news_headline + - field.field.node.news.field_news_logo + - field.field.node.news.field_news_referenced_solution + - field.field.node.news.field_news_source_url + - field.field.node.news.field_news_spatial_coverage + - field.field.node.news.field_shared_in + - field.field.node.news.field_site_featured + - field.field.node.news.field_state + - field.field.node.news.field_topic + - field.field.node.news.og_audience + - node.type.news + - responsive_image.styles.highlighted_solution + module: + - field_delimiter + - field_formatter_range + - field_group + - layout_builder + - responsive_image + - smart_trim + - template_suggestion + - user +third_party_settings: + field_group: + group_references: + children: + - field_news_source_url + parent_name: '' + weight: 19 + format_type: html_element + format_settings: + id: '' + classes: '' + element: div + show_label: true + label_element: h3 + attributes: '' + effect: none + speed: fast + label: References + region: hidden + layout_builder: + allow_custom: false + enabled: false +id: node.news.highlighted +targetEntityType: node +bundle: news +mode: highlighted +content: + body: + label: hidden + type: smart_trim + weight: 2 + settings: + trim_length: 200 + trim_type: chars + trim_suffix: '' + wrap_class: trimmed + more_text: More + more_class: more-link + summary_handler: full + wrap_output: false + more_link: false + trim_options: + text: false + trim_zero: false + third_party_settings: + template_suggestion: + template_suggestion: '' + region: content + field_news_logo: + type: responsive_image + weight: 0 + region: content + label: hidden + settings: + responsive_image_style: highlighted_solution + image_link: content + third_party_settings: + template_suggestion: + template_suggestion: '' + field_topic: + type: entity_reference_label + weight: 1 + region: content + label: hidden + settings: + link: true + third_party_settings: + field_delimiter: + delimiter: '' + field_formatter_range: + order: 0 + limit: 2 + offset: 0 + template_suggestion: + template_suggestion: '' +hidden: + field_attachment: true + field_comments: true + field_keywords: true + field_news_headline: true + field_news_referenced_solution: true + field_news_source_url: true + field_news_spatial_coverage: true + field_shared_in: true + field_site_featured: true + field_state: true + langcode: true + links: true + og_audience: true + published_at: true + read_more: true + report: true + share_link: true diff --git a/config/sync/core.entity_view_mode.node.highlighted_event.yml b/config/sync/core.entity_view_mode.node.highlighted_event.yml new file mode 100644 index 0000000000..eb158adab9 --- /dev/null +++ b/config/sync/core.entity_view_mode.node.highlighted_event.yml @@ -0,0 +1,10 @@ +uuid: f0f4ebec-5d74-4af5-8676-7c741149ec6d +langcode: en +status: true +dependencies: + module: + - node +id: node.highlighted_event +label: 'Highlighted event' +targetEntityType: node +cache: true diff --git a/config/sync/entityqueue.entity_queue.highlighted_solution.yml b/config/sync/entityqueue.entity_queue.highlighted_content.yml similarity index 58% rename from config/sync/entityqueue.entity_queue.highlighted_solution.yml rename to config/sync/entityqueue.entity_queue.highlighted_content.yml index 2a3d23b081..aa33fe70db 100644 --- a/config/sync/entityqueue.entity_queue.highlighted_solution.yml +++ b/config/sync/entityqueue.entity_queue.highlighted_content.yml @@ -1,24 +1,25 @@ -uuid: c40d0c80-bf7c-4f00-831e-b77871742309 +uuid: d51790d4-39e1-4b51-b2f3-9f9621ff06e6 langcode: en status: true dependencies: module: - - rdf_entity -id: highlighted_solution + - node +id: highlighted_content label: 'Highlighted content' handler: simple handler_configuration: { } entity_settings: - target_type: rdf_entity - handler: 'default:rdf_entity' + target_type: node + handler: 'default:node' handler_settings: target_bundles: - collection: collection - solution: solution + document: document + event: event + news: news sort: field: _none auto_create: false - auto_create_bundle: '' + auto_create_bundle: event queue_settings: min_size: 1 max_size: 1 diff --git a/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml b/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml index 39b2ffe9c7..fb4f561dae 100644 --- a/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml +++ b/config/sync/page_manager.page_variant.homepage-layout_builder-0.yml @@ -31,18 +31,18 @@ variant_settings: context_mapping: { } additional: { } weight: 0 - 204e8ccb-280d-4ee4-b598-74b9f96d6496: - uuid: 204e8ccb-280d-4ee4-b598-74b9f96d6496 + 7807ee72-f98e-46bb-80d9-fe1d2b6cd8de: + uuid: 7807ee72-f98e-46bb-80d9-fe1d2b6cd8de region: second configuration: - id: 'entityqueue_block:highlighted_solution' + id: 'entityqueue_block:highlighted_content' label: 'Highlighted content' provider: entityqueue_block label_display: visible view_mode: highlighted context_mapping: { } additional: { } - weight: 0 + weight: 1 third_party_settings: { } - layout_id: joinup_layout_twocol_60_40 @@ -70,7 +70,7 @@ variant_settings: label: 'Highlighted event' provider: entityqueue_block label_display: visible - view_mode: highlighted + view_mode: highlighted_event context_mapping: { } additional: { } weight: 0 diff --git a/tests/behat.yml.dist b/tests/behat.yml.dist index 3f3d20e746..17479748ae 100644 --- a/tests/behat.yml.dist +++ b/tests/behat.yml.dist @@ -113,7 +113,7 @@ default: Header menu: '#block-joinup-theme-main-menu' Header: '.section--featured, .section-header' Highlighted event: '.block-entityqueue--highlighted-event' - Highlighted content: '.block-entityqueue--highlighted-solution' + Highlighted content: '.block-entityqueue--highlighted-content' In the spotlight: '.block-views-blockin-the-spotlight-block' Left sidebar: '.section--sidebar-left' Main solution vertical tab: '#edit-group-main' diff --git a/tests/features/homepage.feature b/tests/features/homepage.feature index 967b3f3c2a..390a32766c 100644 --- a/tests/features/homepage.feature +++ b/tests/features/homepage.feature @@ -90,25 +90,72 @@ Feature: Homepage | 3 | alan.jpg | HR, Statistics and Analysis | Microgravity | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | @terms - Scenario: A solution can be highlighted on the homepage - Given solution: - | title | Mercury poisoning | - | state | validated | - | description | Mercury poisoning is a type of metal poisoning due to exposure to mercury. | - | logo | logo.png | - | solution type | Interoperability Specification, Networking Service | - | topic | Demography, EU and European Policies, HR | - | state | validated | + Scenario: A document can be highlighted on the homepage + Given collection: + | title | Clash of document's | + | state | validated | + And document content: + | title | collection | topic | state | logo | body | + | Microgravity | Clash of document's | HR, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | Alliens | Clash of document's | Statistics and Analysis, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | Groundforce | Clash of document's | Statistics and Analysis, E-justice | proposed | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + And the "Highlighted content" content listing contains: + | type | label | + | document | Alliens | + + When I am on the homepage + Then I should see "Alliens" as the Highlighted content + And I should see the link "Related content" + When I click "Related content" + Then I should be on the advanced search page + And the "Document" content checkbox item should be selected + And I should see the "Alliens" tile + And I should not see the "Microgravity" tile + And I should not see the "Groundforce" tile + + @terms + Scenario: A news can be highlighted on the homepage + Given collection: + | title | Clash of new's | + | state | validated | + And news content: + | title | headline | collection | topic | state | publication date | body | + | Some title | Some headline | Clash of new's | E-justice | validated | 2021-04-26T19:09:00Z | Body | + | Internet medicine | It cures virtually everything | Clash of new's | E-health Dpt. | validated | 2014-02-22T19:26:57Z | Electronic healthcare | And the "Highlighted content" content listing contains: - | type | label | - | solution | Mercury poisoning | + | type | label | + | news | Some title | When I am on the homepage - Then I should see "Mercury poisoning" as the Highlighted content + Then I should see "Some title" as the Highlighted content And I should see the link "Related content" When I click "Related content" Then I should be on the advanced search page - And the "Solution" content checkbox item should be selected + And the "News" content checkbox item should be selected + And I should see the "Some title" tile + And I should not see the "Internet medicine" tile + + @terms + Scenario: A event can be highlighted on the homepage + Given collection: + | title | Clash of event's | + | state | validated | + Given event content: + | title | collection | topic | state | logo | body | + | Lisbon steak festival | Clash of event's | E-justice | validated | charles.jpg | Two groups of mice (six per group) were housed aboard the International Space Station for 35 days. One group was subjected to artificial gravity (1 g) and the other to microgravity. | + | Oeiras steak festival | Clash of event's | EU and European Policies | validated | charles.jpg | Two groups of mice (six per group) were housed aboard the International Space Station for 35 days. One group was subjected to artificial gravity (1 g) and the other to microgravity. | + And the "Highlighted content" content listing contains: + | type | label | + | event | Lisbon steak festival | + + When I am on the homepage + Then I should see "Lisbon steak festival" as the Highlighted content + And I should see the link "Related content" + When I click "Related content" + Then I should be on the advanced search page + And the "Event" content checkbox item should be selected + And I should see the "Lisbon steak festival" tile + And I should not see the "Oeiras steak festival" tile Scenario: An event can be highlighted on the homepage Given event content: diff --git a/tests/src/Context/SolutionContext.php b/tests/src/Context/SolutionContext.php index ce7e778b56..1cef54e331 100644 --- a/tests/src/Context/SolutionContext.php +++ b/tests/src/Context/SolutionContext.php @@ -856,17 +856,18 @@ public function setDownloadCountForEntity(string $type, string $target_entity_la * * @Then I should see :label as the Highlighted content */ - public function assertHighlightedSolution(string $label): void { - $solution = self::getSolutionByName($label); + public function assertHighlightedContent(string $label): void { + /** @var \Drupal\custom_page\Entity\CustomPageInterface $content */ + $content = self::getNodeByTitle($label); - $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-solution'); + $block_element = $this->getSession()->getPage()->find('css', '.block-entityqueue--highlighted-content'); // Check block title. $actual_block_title = $block_element->find('css', 'h2')->getText(); Assert::assertEquals('Highlighted content', $actual_block_title, sprintf('Expected the Highlighted content block to have the title "Highlighted content" but instead found "%s".', $actual_block_title)); // Check that the logo is present. - if ($logo = $solution->getLogoAsFile()) { + if ($logo = $content->getLogoAsFile()) { $filename = $logo->getFilename(); $logo_is_present = self::hasImage($filename, $block_element); Assert::assertTrue($logo_is_present, sprintf('Image with filename "%s" has been found in the Highlighted content block.', $filename)); @@ -874,15 +875,15 @@ public function assertHighlightedSolution(string $label): void { // Check title text. $actual_title = $block_element->find('css', 'article h2')->getText(); - Assert::assertEquals($solution->label(), $actual_title, sprintf('Expected the Highlighted content to have the title "%s" but instead found "%s".', $solution->label(), $actual_title)); + Assert::assertEquals($content->label(), $actual_title, sprintf('Expected the Highlighted content to have the title "%s" but instead found "%s".', $content->label(), $actual_title)); // Check that title links to the canonical page of the solution. - $xpath = '//h2/a[@href = "' . $solution->toUrl()->toString() . '"]'; - Assert::assertNotEmpty($block_element->find('xpath', $xpath), sprintf('Solution "%s" does not link to the canonical page.', $actual_title)); + $xpath = '//h2/a[@href = "' . $content->toUrl()->toString() . '"]'; + Assert::assertNotEmpty($block_element->find('xpath', $xpath), sprintf('%s "%s" does not link to the canonical page.', $content->getType(), $actual_title)); // Retrieve the topics from the solution, limiting the result to maximum 2 // topics. - $topics = array_slice($solution->getTopics(), 0, 2); + $topics = array_slice($content->getTopics(), 0, 2); // Check that the correct number of topics are present. $topic_elements = $block_element->findAll('css', '.field--name-field-topic .field__item'); @@ -902,7 +903,7 @@ public function assertHighlightedSolution(string $label): void { } // Check that the description is present. - $actual_description = $block_element->find('css', '.field--name-field-is-description')->getText(); + $actual_description = $block_element->find('css', '.field--name-body')->getText(); Assert::assertNotEmpty($actual_description); } diff --git a/web/modules/custom/joinup_event/joinup_event.module b/web/modules/custom/joinup_event/joinup_event.module index 24142e7306..ab90e1016a 100644 --- a/web/modules/custom/joinup_event/joinup_event.module +++ b/web/modules/custom/joinup_event/joinup_event.module @@ -57,9 +57,9 @@ function joinup_event_entity_type_alter(array &$entity_types): void { function joinup_event_theme($existing, $type, $theme, $path) { return [ // Use a custom template for the highlighted event on the homepage. - 'node__event__highlighted' => [ + 'node__event__highlighted_event' => [ 'base hook' => 'node', - 'template' => 'node--event--highlighted', + 'template' => 'node--event--highlighted-event', ], ]; } @@ -67,7 +67,7 @@ function joinup_event_theme($existing, $type, $theme, $path) { /** * Prepares variables for the highlighted event template. * - * Default template: node--event--highlighted.html.twig. + * Default template: node--event--highlighted-event.html.twig. * * The highlighted event is displayed on the homepage and is managed through an * entityqueue. It has a number of additional fields (header text and a call to @@ -81,7 +81,7 @@ function joinup_event_theme($existing, $type, $theme, $path) { * @see hook_entity_type_build() * @see \Drupal\Core\Field\BaseFieldDefinition::setDisplayConfigurable() */ -function template_preprocess_node__event__highlighted(array &$variables) { +function joinup_event_preprocess_node__event__highlighted_event(array &$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; diff --git a/web/modules/custom/joinup_event/templates/node--event--highlighted.html.twig b/web/modules/custom/joinup_event/templates/node--event--highlighted-event.html.twig similarity index 100% rename from web/modules/custom/joinup_event/templates/node--event--highlighted.html.twig rename to web/modules/custom/joinup_event/templates/node--event--highlighted-event.html.twig diff --git a/web/themes/ventuno/src/scss/components/_highlighted-solution-block.scss b/web/themes/ventuno/src/scss/components/_highlighted-content-block.scss similarity index 92% rename from web/themes/ventuno/src/scss/components/_highlighted-solution-block.scss rename to web/themes/ventuno/src/scss/components/_highlighted-content-block.scss index ae10fd3edb..ac84de06ee 100644 --- a/web/themes/ventuno/src/scss/components/_highlighted-solution-block.scss +++ b/web/themes/ventuno/src/scss/components/_highlighted-content-block.scss @@ -1,5 +1,5 @@ -// Highlighted Solution -.block-entityqueue--highlighted-solution { +// Highlighted Content +.block-entityqueue--highlighted-content { @extend .pb-5; border-bottom: 1px solid rgba($primary, .1); position: relative; @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/web/themes/ventuno/src/scss/components/_homepage.scss b/web/themes/ventuno/src/scss/components/_homepage.scss index 4c41c34a14..0d40ae4a51 100644 --- a/web/themes/ventuno/src/scss/components/_homepage.scss +++ b/web/themes/ventuno/src/scss/components/_homepage.scss @@ -21,7 +21,7 @@ } } .view-in-the-spotlight, -.block-entityqueue--highlighted-solution, +.block-entityqueue--highlighted-content, .view-latest-news { .views-row { @extend .mb-4; diff --git a/web/themes/ventuno/src/scss/homepage.scss b/web/themes/ventuno/src/scss/homepage.scss index 0791e76be8..83a2a2d566 100644 --- a/web/themes/ventuno/src/scss/homepage.scss +++ b/web/themes/ventuno/src/scss/homepage.scss @@ -15,7 +15,7 @@ @import "components/in-the-spotlight-block"; @import "components/latest-news-block"; @import "components/navbar"; -@import "components/highlighted-solution-block"; +@import "components/highlighted-content-block"; @import "components/highlighted-event-block"; @import "components/global-search-block"; @import "components/explore-block"; diff --git a/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig b/web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig similarity index 100% rename from web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-solution.html.twig rename to web/themes/ventuno/templates/block/block--entityqueue-block--highlighted-content.html.twig diff --git a/web/themes/ventuno/templates/content/node--document--highlighted.html.twig b/web/themes/ventuno/templates/content/node--document--highlighted.html.twig new file mode 100644 index 0000000000..596930ee58 --- /dev/null +++ b/web/themes/ventuno/templates/content/node--document--highlighted.html.twig @@ -0,0 +1,18 @@ +{# +/** + * @file + * Themeing for document node highlighted. + */ +#} + + {{ content.field_document_logo }} + {{ content.field_topic }} + {{ title_prefix }} + {% if not page and not is_label_hidden %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + {{ content|without('field_document_logo', 'field_topic') }} + diff --git a/web/themes/ventuno/templates/content/node--event--highlighted.html.twig b/web/themes/ventuno/templates/content/node--event--highlighted.html.twig new file mode 100644 index 0000000000..0ee66e2854 --- /dev/null +++ b/web/themes/ventuno/templates/content/node--event--highlighted.html.twig @@ -0,0 +1,18 @@ +{# +/** + * @file + * Themeing for event node highlighted. + */ +#} + + {{ content.field_event_logo }} + {{ content.field_topic }} + {{ title_prefix }} + {% if not page and not is_label_hidden %} + + {{ label }} + + {% endif %} + {{ title_suffix }} + {{ content|without('field_event_logo', 'field_topic') }} + diff --git a/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig b/web/themes/ventuno/templates/content/node--news--highlighted.html.twig similarity index 68% rename from web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig rename to web/themes/ventuno/templates/content/node--news--highlighted.html.twig index fbf1ed495b..600cc3d604 100644 --- a/web/themes/ventuno/templates/rdf-entity/rdf-entity--collection--highlighted.html.twig +++ b/web/themes/ventuno/templates/content/node--news--highlighted.html.twig @@ -1,11 +1,11 @@ {# /** * @file - * Themeing for rdf entities. + * Themeing for news node highlighted. */ #} - {{ content.field_ar_logo }} + {{ content.field_news_logo }} {{ content.field_topic }} {{ title_prefix }} {% if not page and not is_label_hidden %} @@ -14,5 +14,5 @@ {% endif %} {{ title_suffix }} - {{ content|without('field_ar_logo', 'field_topic') }} + {{ content|without('field_news_logo', 'field_topic') }} diff --git a/web/themes/ventuno/ventuno.theme b/web/themes/ventuno/ventuno.theme index 2333750f8c..0e59e8445d 100644 --- a/web/themes/ventuno/ventuno.theme +++ b/web/themes/ventuno/ventuno.theme @@ -141,19 +141,20 @@ function ventuno_preprocess_page(&$variables) { * Implements hook_preprocess_block(). */ function ventuno_preprocess_block(&$variables) { - if ($variables['derivative_plugin_id'] == 'highlighted_solution') { + if ($variables['derivative_plugin_id'] == 'highlighted_content') { + if (isset($variables['elements']['content']['entities'][0])) { - /** @var \Drupal\rdf_entity\RdfInterface $entity */ - $entity = $variables['elements']['content']['entities'][0]['#rdf_entity']; + /** @var \Drupal\node\NodeInterface $node */ + $node = $variables['elements']['content']['entities'][0]['#node']; - $topics = $entity->get('field_topic')->getValue(); + $topics = $node->get('field_topic')->getValue(); $options = [ 'query' => [ 'f' => [ - 'type:' . $entity->bundle(), + 'type:' . $node->bundle(), 'topic:' . reset($topics)["target_id"], ], ], From 3fdb29f782a043f3d0eb801264ebb1a4d0dc8e51 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Fri, 22 Oct 2021 16:43:05 +0100 Subject: [PATCH 05/17] ISAICP-6765: Fix moderator permissions. --- config/sync/user.role.moderator.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/sync/user.role.moderator.yml b/config/sync/user.role.moderator.yml index c1fbd7b97c..1ee384b2bb 100644 --- a/config/sync/user.role.moderator.yml +++ b/config/sync/user.role.moderator.yml @@ -232,6 +232,7 @@ permissions: - 'update any simple_block block content' - 'update collection_settings meta-entity' - 'update discover_topics entityqueue' + - 'update highlighted_content entityqueue' - 'update highlighted_event entityqueue' - 'update highlighted_solution entityqueue' - 'update paragraph content iframe' From 6cc43a9b7fc0ce079e813a9623f364bb209ead22 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Mon, 25 Oct 2021 15:54:07 +0100 Subject: [PATCH 06/17] ISAICP-6765: Move 3 Scenario into 1 Scenario Outline. --- tests/features/homepage.feature | 70 ++++++++------------------------- 1 file changed, 16 insertions(+), 54 deletions(-) diff --git a/tests/features/homepage.feature b/tests/features/homepage.feature index 390a32766c..c17634fe15 100644 --- a/tests/features/homepage.feature +++ b/tests/features/homepage.feature @@ -90,72 +90,34 @@ Feature: Homepage | 3 | alan.jpg | HR, Statistics and Analysis | Microgravity | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | @terms - Scenario: A document can be highlighted on the homepage + Scenario Outline: A document can be highlighted on the homepage Given collection: - | title | Clash of document's | - | state | validated | - And document content: - | title | collection | topic | state | logo | body | - | Microgravity | Clash of document's | HR, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | - | Alliens | Clash of document's | Statistics and Analysis, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | - | Groundforce | Clash of document's | Statistics and Analysis, E-justice | proposed | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | title | Clash of document's | + | state | validated | + And content: + | title | collection | topic | state | logo | body | + | Microgravity | Clash of document's | HR, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | Alliens | Clash of document's | Statistics and Analysis, E-justice | validated | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | + | Groundforce | Clash of document's | Statistics and Analysis, E-justice | proposed | alan.jpg | Conventional studies investigating the effects of reduced gravity on muscle mass and function have used a ground control group that is not directly comparable to the space experimental group. | And the "Highlighted content" content listing contains: - | type | label | - | document | Alliens | + | type | label | + | | Alliens | When I am on the homepage Then I should see "Alliens" as the Highlighted content And I should see the link "Related content" When I click "Related content" Then I should be on the advanced search page - And the "Document" content checkbox item should be selected + And the