mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 09:30:58 +00:00
[Shop][2.0] Added the ability to render the accordion component that’s expanded by default (#17482)
| Q | A |-----------------|----- | Branch? | 2.0 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | - | License | MIT Added the ability to render the accordion component that’s expanded by default. Make accordion component with details section expanded by default on product show page. 
This commit is contained in:
commit
13239b7715
4 changed files with 4 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{% set product = hookable_metadata.context.product %}
|
{% set product = hookable_metadata.context.product %}
|
||||||
|
|
||||||
{% embed '@SyliusShop/shared/accordion/accordion_item_content.html.twig' with { accordion_item_id: 'details', test_html_attribute: 'product-details' } %}
|
{% embed '@SyliusShop/shared/accordion/accordion_item_content.html.twig' with { accordion_item_id: 'details', expanded: true, test_html_attribute: 'product-details' } %}
|
||||||
{% block accordion_item_content %}
|
{% block accordion_item_content %}
|
||||||
{% if product.description is not empty %}
|
{% if product.description is not empty %}
|
||||||
{{ product.description | nl2br }}
|
{{ product.description | nl2br }}
|
||||||
|
|
@ -9,4 +9,3 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{% embed '@SyliusShop/shared/accordion/accordion_item_title.html.twig' with { accordion_item_id: 'details' } %}
|
{% embed '@SyliusShop/shared/accordion/accordion_item_title.html.twig' with { accordion_item_id: 'details', expanded: true } %}
|
||||||
{% block accordion_item_title %}
|
{% block accordion_item_title %}
|
||||||
{{ 'sylius.ui.details'|trans }}
|
{{ 'sylius.ui.details'|trans }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<div id="{{ accordion_item_id }}" class="accordion-collapse collapse">
|
<div id="{{ accordion_item_id }}" class="accordion-collapse collapse {{ expanded|default(false) ? 'show' : '' }}">
|
||||||
<div class="accordion-body" {{ test_html_attribute is defined ? sylius_test_html_attribute(test_html_attribute) : '' }}>
|
<div class="accordion-body" {{ test_html_attribute is defined ? sylius_test_html_attribute(test_html_attribute) : '' }}>
|
||||||
{% block accordion_item_content %}
|
{% block accordion_item_content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
<h2 class="accordion-header">
|
<h2 class="accordion-header">
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#{{ accordion_item_id }}" aria-expanded="false" aria-controls="{{ accordion_item_id }}">
|
<button class="accordion-button {{ expanded|default(false) ? '' : 'collapsed' }}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ accordion_item_id }}" aria-expanded="{{ expanded|default(false) ? 'true' : 'false' }}" aria-controls="{{ accordion_item_id }}">
|
||||||
<span class="h5 mb-0 py-2">
|
<span class="h5 mb-0 py-2">
|
||||||
{% block accordion_item_title %}
|
{% block accordion_item_title %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue