Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELA-1080: Review patch oe_bootstrap_theme-372+381+385-pattern_customizable | for ELA project #410

Open
wants to merge 4 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions templates/patterns/card/card.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ card:
type: string
label: 'Orientation'
description: 'Can be set to horizontal or vertical. Defaults to vertical.'
left_col_classes:
type: string
label: 'Left column classes'
description: 'When horizontal orientation. Classes of left column.'
preview: 'col-3'
right_col_classes:
type: string
label: 'Right column classes'
description: 'When horizontal orientation. Classes of right column.'
preview: 'col-9'
title:
type: text
label: 'Title'
Expand Down Expand Up @@ -55,6 +65,10 @@ card:
label: 'Content'
description: 'Card content.'
preview: '<button class="btn btn-primary">Custom action</button>'
extra_classes_body:
type: string
label: 'Extra classes body'
description: 'Can be set additional classes for card body/content.'
header:
type: text
label: 'Card header'
Expand All @@ -65,6 +79,10 @@ card:
label: 'Card footer'
description: 'Card footer content.'
preview: 'Footer of card'
extra_classes_footer:
type: string
label: 'Extra classes footer'
description: 'Can be set additional classes for card footer.'
badges:
type: array
label: 'Badges'
Expand Down
12 changes: 10 additions & 2 deletions templates/patterns/card/pattern-card.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
*/
#}
{% apply spaceless %}
{% set _image = image ? image|merge({
'path': image.src,
'alt': image.alt,
}) %}
{% set _left_col_classes = left_col_classes|default('col-4') %}
{% set _right_col_classes = right_col_classes|default('col-8') %}
{% set _content %}
{% if meta is not empty %}
{# Use negative margin to compensate for me-3 on each item. #}
Expand Down Expand Up @@ -35,8 +41,8 @@
{% include '@oe-bcl/card' with {
'horizontal': orientation == 'horizontal',
'horizontal_grid': (orientation == 'horizontal') ? {
left_col_classes: 'col-4',
right_col_classes: 'col-8',
left_col_classes: _left_col_classes,
right_col_classes: _right_col_classes,
gutter: 0,
} : {},
'title': title,
Expand All @@ -51,13 +57,15 @@
'tag': 'div',
} : {},
'content': _content,
'extra_classes_body' : extra_classes_body,
'image': image ? {
'path': image.src,
'alt': image.alt,
},
'date': date|default({}),
'card_header': header,
'card_footer': footer,
'extra_classes_footer' : extra_classes_footer,
'badges': _badges,
'attributes': attributes,
} only %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#}
{% apply spaceless %}
{# Render the 'meta' items into the content variable. #}
{% set _image = image ? image|merge({
'path': image.src,
'alt': image.alt,
}) %}
{% set _content %}
{% set content_attributes = create_attribute().addClass(['mt-4', 'card-content']) %}
{% if meta is not empty %}
Expand Down Expand Up @@ -37,10 +41,7 @@
'title': title,
'title_tag': title_tag,
'content': _content,
'image': image ? {
'path': image.src,
'alt': image.alt,
} : {},
'image': _image,
'image_size': image_size ?? 'lg',
'badges': _badges,
'links': links,
Expand Down