Skip to content

Commit

Permalink
EWPP-4336: Add support of contextual links for list_item pattern.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergepavle committed May 15, 2024
1 parent da52b0a commit 39bec32
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@
{% if loop.last %}
{% set last_item_css = "last-item" %}
{% endif %}
<div class="ecl-content-item-block__item ecl-u-mb-l {{ _extra_classes_item }} vertical">
<div class="ecl-content-item-block__item contextual-region ecl-u-mb-l {{ _extra_classes_item }} vertical">
{% for _item in column %}
{% if loop.last %}
{% set last_item_column_css = "last-item-column" %}
{% if last_item_css is not empty %}
{% set last_item_column_css = last_item_column_css ~ " " ~ last_item_css %}
{% endif %}
{% endif %}
<div class="ecl-content-item-block__item ecl-u-mb-l {{ last_item_column_css }}">
<div class="ecl-content-item-block__item contextual-region ecl-u-mb-l {{ last_item_column_css }}">
{{ _item }}
</div>
{% endfor %}
Expand All @@ -93,7 +93,7 @@
{% if loop.last %}
{% set last_item_column_css = last_item_column_css ~ " last-item" %}
{% endif %}
<div class="ecl-content-item-block__item ecl-u-mb-l {{ _extra_classes_item }} {{ last_item_column_css }}">
<div class="ecl-content-item-block__item contextual-region ecl-u-mb-l {{ _extra_classes_item }} {{ last_item_column_css }}">
{{ _item }}
</div>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
{% endif %}
{% if highlighted is not empty and items is not empty %}
<div class="ecl-row">
<div class="ecl-col-l-8 ecl-u-d-flex ecl-u-flex-column">
<div class="ecl-col-l-8 ecl-u-d-flex ecl-u-flex-column contextual-region">
{{ highlighted }}
</div>
<div class="ecl-col-l-4 ecl-u-d-flex ecl-u-flex-column">
<div class="ecl-col-l-4 ecl-u-d-flex ecl-u-flex-column contextual-region">
{% for item in items %}
{{ item }}
{% endfor %}
Expand Down
5 changes: 5 additions & 0 deletions templates/patterns/file_teaser/file_teaser.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ file_teaser:
preview:
- label: "Highlighted"
variant: "highlight"
contextual_links:
type: "array"
label: "Contextual links"
description: "Render array of contextual links"
preview: ~
2 changes: 2 additions & 0 deletions templates/patterns/file_teaser/pattern-file-teaser.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
} %}
{% endif %}

{{ contextual_links }}

{% include '@ecl-twig/file' with {
'title': file.title,
'description': teaser|smart_trim(_length),
Expand Down
5 changes: 5 additions & 0 deletions templates/patterns/link/link.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ link:
label: "External link"
description: "Whether the URL is external or not."
preview: true
contextual_links:
type: "array"
label: "Contextual links"
description: "Render array of contextual links"
preview: ~
1 change: 1 addition & 0 deletions templates/patterns/link/pattern-link.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Link pattern.
*/
#}
{{ contextual_links }}
{% include '@ecl-twig/link' with {
link: {
type: variant|default('standalone'),
Expand Down
5 changes: 5 additions & 0 deletions templates/patterns/list_item/list_item.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ list_item:
label: "List item: cancelled event"
description: "Default list item elements and date."
fields:
contextual_links:
type: "array"
label: "Contextual links"
description: "Render array of contextual links"
preview: ~
url:
type: "Url"
label: "URL"
Expand Down
3 changes: 3 additions & 0 deletions templates/patterns/list_item/pattern-list-item.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- "external_link" (bool) (default: false): Whether the link is external or not.
- "lists" (array) (default: []): Array of lists compatible with ECL Description list component.
- "divider" (bool) (default: false): Whether to set a divider below the item.
- "contextual_links" (array) (default: ''): Render array for contextual links.
- "extra_classes" (string) (default: '')
#}

Expand Down Expand Up @@ -156,6 +157,8 @@
{% endfor %}
{% endif %}

{{ contextual_links }}

{% include '@ecl-twig/content-item' with {
picture: picture|default([]),
labels: labels|default([]),
Expand Down

0 comments on commit 39bec32

Please sign in to comment.