Skip to content

Commit 1be8510

Browse files
committed
FEAT: Open shop preview and nessecary user dropdown links in new tab
1 parent 62c1327 commit 1be8510

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/Sylius/Bundle/AdminBundle/Twig/Component/Shared/Navbar/UserDropdownComponent.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,19 @@ public function getMenuItems(): array
6565
'title' => 'sylius.ui.documentation',
6666
'url' => 'https://docs.sylius.com',
6767
'class' => 'small text-muted',
68+
'target' => '_blank'
6869
],
6970
[
7071
'title' => 'sylius.ui.join_slack',
7172
'url' => 'https://sylius.com/slack',
7273
'class' => 'small text-muted',
74+
'target' => '_blank'
7375
],
7476
[
7577
'title' => 'sylius.ui.report_an_issue',
7678
'url' => 'https://github.com/Sylius/Sylius/issues',
7779
'class' => 'small text-muted',
80+
'target' => '_blank'
7881
],
7982
];
8083
}

src/Sylius/Bundle/AdminBundle/templates/shared/crud/common/navbar/menu/shop_preview.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% if channels|length == 1 %}
44
{% set channel = channels|first %}
5-
<a class="" href="{{ sylius_channel_url(homepage_path, channel) }}">
5+
<a class="" href="{{ sylius_channel_url(homepage_path, channel) }}" target="_blank">
66
<span data-bs-toggle="tooltip" data-bs-title="{{ 'sylius.ui.view_your_store'|trans }}" data-bs-placement="right">
77
{{ ux_icon('tabler:arrow-up-right') }}
88
</span>

src/Sylius/Bundle/AdminBundle/templates/shared/helper/dropdown.html.twig

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
type: null,
3333
class: null,
3434
icon: null,
35+
target: null,
3536
attributes: {}
3637
}|merge(item) %}
3738

@@ -41,10 +42,17 @@
4142
<hr class="dropdown-divider">
4243
{% else %}
4344
{% set extra_class = item.class ? ' ' ~ item.class %}
44-
<a class="dropdown-item{{ item.class ? extra_class }}" href="{{ item.url }}" {{ sylius_test_html_attribute('user-dropdown-item', item.title|trans({}, null, 'en_US')) }} {% for attr, value in item.attributes %}{{ attr }}="{{ value }}" {% endfor %}>
45-
{{ item.icon ? ux_icon(item.icon, {'class': 'icon dropdown-item-icon ' ~ extra_class }) }}
46-
{{ item.title|trans }}
47-
</a>
45+
{% if item.target == '_blank' %}
46+
<a class="dropdown-item{{ item.class ? extra_class }}" href="{{ item.url }}" target="_blank" {{ sylius_test_html_attribute('user-dropdown-item', item.title|trans({}, null, 'en_US')) }} {% for attr, value in item.attributes %}{{ attr }}="{{ value }}" {% endfor %}>
47+
{{ item.icon ? ux_icon(item.icon, {'class': 'icon dropdown-item-icon ' ~ extra_class }) }}
48+
{{ item.title|trans }}
49+
</a>
50+
{% else %}
51+
<a class="dropdown-item{{ item.class ? extra_class }}" href="{{ item.url }}" {{ sylius_test_html_attribute('user-dropdown-item', item.title|trans({}, null, 'en_US')) }} {% for attr, value in item.attributes %}{{ attr }}="{{ value }}" {% endfor %}>
52+
{{ item.icon ? ux_icon(item.icon, {'class': 'icon dropdown-item-icon ' ~ extra_class }) }}
53+
{{ item.title|trans }}
54+
</a>
55+
{% endif %}
4856
{% endif %}
4957
{% endfor %}
5058
{% endset %}

0 commit comments

Comments
 (0)