Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

ISAICP-6765: “Highlighted Solution” will become “Highlighted Content”. #2631

Open
wants to merge 19 commits into
base: ISAICP-6415
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
b7bdcb4
ISAICP-6765: “Highlighted Solution” will become “Highlighted Content”.
saidatom Oct 20, 2021
c31c06e
ISAICP-6765: Fix class block_element higlight content.
saidatom Oct 20, 2021
bbe23c6
ISAICP-6765: Fix click More solutions to Related content.
saidatom Oct 20, 2021
ccdb406
Merge remote-tracking branch 'origin/ISAICP-6415' into ISAICP-6765
pfrenssen Oct 21, 2021
dcf530c
ISAICP-6765: Fix highlighted view modes.
saidatom Oct 21, 2021
3fdb29f
ISAICP-6765: Fix moderator permissions.
saidatom Oct 22, 2021
6cc43a9
ISAICP-6765: Move 3 Scenario into 1 Scenario Outline.
saidatom Oct 25, 2021
cc836a5
ISAICP-6765: Ensure all different highlighted node types can be style…
pfrenssen Oct 26, 2021
b737263
ISAICP-6765: Fix typo.
pfrenssen Oct 26, 2021
a2fc0da
Merge remote-tracking branch 'origin/ISAICP-6415' into ISAICP-6765
saidatom Oct 26, 2021
c43474a
ISAICP-6765: Rename image style and fix text style.
saidatom Oct 27, 2021
45ead57
ISAICP-6765: Allow users with permission to access the new 'Highlight…
pfrenssen Oct 28, 2021
ee5ea03
ISAICP-6765: Align tables.
pfrenssen Oct 28, 2021
039962d
ISAICP-6765: Ensure the content of solutions is adequately stripped b…
pfrenssen Oct 28, 2021
54175a3
ISAICP-6765: Maintain alphabetical ordering.
pfrenssen Oct 28, 2021
91af5ba
ISAICP-6765: Move assertion to the right context now that we are chec…
pfrenssen Oct 28, 2021
3305df9
ISAICP-6765: Update documentation.
pfrenssen Oct 28, 2021
10a68c1
ISAICP-6765: Check that highlighted content is community content.
pfrenssen Oct 28, 2021
44183ca
ISAICP-6765: Process the Highlighted Content block in a more concise …
pfrenssen Oct 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ dependencies:
module:
- rdf_entity
id: highlighted_solution
label: 'Highlighted solution'
label: 'Highlighted content'
handler: simple
handler_configuration: { }
entity_settings:
target_type: rdf_entity
handler: 'default:rdf_entity'
handler_settings:
target_bundles:
collection: collection
solution: solution
sort:
field: _none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions tests/features/homepage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ 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
And I should see the link "More solutions"
When I click "More solutions"
Then I should see "Mercury poisoning" as the Highlighted content
And I should see the link "Related content"
When I click "Related content"
pfrenssen marked this conversation as resolved.
Show resolved Hide resolved
Then I should be on the advanced search page
And the "Solution" content checkbox item should be selected

Expand Down
3 changes: 1 addition & 2 deletions tests/features/joinup_core/social_share.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions tests/features/moderator/curated_content_listings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
16 changes: 8 additions & 8 deletions tests/src/Context/SolutionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -847,14 +847,14 @@ 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.
pfrenssen marked this conversation as resolved.
Show resolved Hide resolved
*
* This is shown on the homepage.
*
* @param string $label
* The label of the solution that is highlighted on the homepage.
pfrenssen marked this conversation as resolved.
Show resolved Hide resolved
*
* @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);
Expand All @@ -863,18 +863,18 @@ public function assertHighlightedSolution(string $label): void {

// 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() . '"]';
Expand All @@ -886,19 +886,19 @@ 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 */
$topic_element = array_shift($topic_elements);

// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{% endif %}
{{ title_suffix }}
{% block content %}
<a href="{{ path('view.search.page_1', {}, {query: {f: ['type:solution']}}) }}" class="more-link">{{ 'More solutions'|t }}</a>
{{ related_content }}
{{ content }}
{% endblock %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{#
/**
* @file
* Themeing for rdf entities.
*/
#}
<article{{ attributes }}>
{{ content.field_ar_logo }}
{{ content.field_topic }}
{{ title_prefix }}
{% if not page and not is_label_hidden %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{{ content|without('field_ar_logo', 'field_topic') }}
</article>
pfrenssen marked this conversation as resolved.
Show resolved Hide resolved
33 changes: 33 additions & 0 deletions web/themes/ventuno/ventuno.theme
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,39 @@ 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') {
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();

$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'],
],
];
}
}
}
pfrenssen marked this conversation as resolved.
Show resolved Hide resolved

/**
* Implements hook_preprocess_HOOK().
*
Expand Down