forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Admin][Product] Add view in store button
- Loading branch information
Showing
6 changed files
with
59 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...e/AdminBundle/templates/product/common/header/title_block/actions/view_in_store.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% from '@SyliusAdmin/shared/helper/icon.html.twig' import icon as _icon %} | ||
|
||
{% set product = (hookable_metadata.context.resource) %} | ||
{% set enabledChannels = product.channels|filter(channel => channel.enabled == true) %} | ||
|
||
{% if sylius_bundle_loaded_checker('SyliusShopBundle') %} | ||
{% if not product.enabled or enabledChannels|length < 1 %} | ||
<a class="btn disabled" href="{{ (url is not defined) ? '#' : url|raw }}" target="_blank" {{ sylius_test_html_attribute('view-in-store') }}> | ||
{{ _icon({ icon: 'arrow-up-right', class: 'icon icon-tabler' }) }} | ||
{{ 'sylius.ui.view_in_store'|trans }} | ||
</a> | ||
{% elseif enabledChannels|length > 1 %} | ||
<div class="dropdown"> | ||
<button class="btn dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> | ||
{{ 'sylius.ui.view_in_store'|trans }} | ||
</button> | ||
<ul class="dropdown-menu" {{ sylius_test_html_attribute('view-in-store') }}> | ||
{% for channel in enabledChannels %} | ||
{% set product_translation = sylius_product_translation(product, channel) %} | ||
{% if product_translation is not null %} | ||
{% set url = sylius_channel_url(path('sylius_shop_product_show', {'slug': product_translation.slug, '_locale': product_translation.locale}), channel) %} | ||
{% endif %} | ||
|
||
<li> | ||
<a | ||
class="dropdown-item{% if url is not defined %} disabled{% endif %}" | ||
href="{{ (url is not defined) ? '#' : url|raw }}" | ||
target="_blank" | ||
> | ||
{{ _icon({ icon: 'arrow-up-right', class: 'icon dropdown-item-icon icon-tabler' }) }} | ||
{{ channel.name }} ({{ channel.code }}) | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% else %} | ||
{% for channel in enabledChannels %} | ||
{% set product_translation = sylius_product_translation(product, channel) %} | ||
{% if product_translation is not null %} | ||
{% set url = sylius_channel_url(path('sylius_shop_product_show', {'slug': product_translation.slug, '_locale': product_translation.locale}), channel) %} | ||
{% endif %} | ||
|
||
<a class="btn" href="{{ (url is not defined) ? '#' : url|raw }}" target="_blank" {{ sylius_test_html_attribute('view-in-store') }}> | ||
{{ _icon({ icon: 'arrow-up-right', class: 'icon icon-tabler' }) }} | ||
{{ 'sylius.ui.view_in_store'|trans }} | ||
</a> | ||
{% endfor %} | ||
{% endif %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
...ius/Bundle/AdminBundle/templates/product/update/header/title_block/actions/more.html.twig
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...inBundle/templates/product/update/header/title_block/actions/more/view_in_store.html.twig
This file was deleted.
Oops, something went wrong.