Skip to content

Commit 340fe70

Browse files
committed
OP-551: Add hookables for actions and tweak styles
1 parent 87ccb23 commit 340fe70

File tree

14 files changed

+120
-96
lines changed

14 files changed

+120
-96
lines changed

src/Resources/assets/shop/js/wishlistMainCheckboxUpdater.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class WishlistMainCheckboxUpdater {
66
this.defaultConfig = {
77
mainCheckboxId: '#toggle-checkboxes',
88
checkboxesData: '[data-bb-checkboxes] input',
9-
bulkActionsBtnClass: '.bb-colective-actions',
9+
bulkActionsBtnClass: '.bb-collective-actions',
1010
};
1111
this.finalConfig = {...this.defaultConfig, ...config};
1212
this.mainCheckbox = document.querySelector(this.finalConfig.mainCheckboxId)
Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,9 @@
1-
.bb-colective-actions {
2-
&.disabled {
3-
opacity: .45;
4-
pointer-events: none;
5-
}
6-
7-
&.enabled {
8-
}
9-
10-
.wishlist-dropdown-menu {
11-
&__item {
12-
.wishlist-item--button {
13-
text-align: left;
14-
background: #ffffff !important;
15-
color: rgba(0, 0, 0, 0.95) !important;
16-
width: 100%;
17-
}
18-
19-
.wishlist-item--button:hover {
20-
background: #E0E1E2 !important;
21-
}
22-
}
23-
24-
&__item:hover {
25-
background: #ffffff !important;
1+
.bb-dropdown {
2+
.dropdown-item {
3+
&:hover,
4+
&:focus,
5+
&:active{
6+
background-color: transparent;
267
}
278
}
289
}

src/Resources/config/twig_hooks/shop/wishlist/index.yaml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,36 @@ sylius_twig_hooks:
4343
priority: 0
4444

4545
'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.actions':
46-
collective_actions:
47-
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/collective_actions.html.twig"
46+
bulk:
47+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/bulk.html.twig"
4848
priority: 100
49-
global_actions:
50-
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/global_actions.html.twig"
49+
global:
50+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/global.html.twig"
51+
priority: 0
52+
53+
'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.actions.global':
54+
import:
55+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/global/import.html.twig"
56+
priority: 100
57+
add_to_cart:
58+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/global/add_to_cart.html.twig"
59+
priority: 0
60+
61+
'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.actions.bulk':
62+
add_to_cart:
63+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/bulk/add_to_cart.html.twig"
64+
priority: 400
65+
remove:
66+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/bulk/remove.html.twig"
67+
priority: 300
68+
copy:
69+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/bulk/copy.html.twig"
70+
priority: 200
71+
download_csv:
72+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/bulk/download_csv.html.twig"
73+
priority: 100
74+
download_pdf:
75+
template: "@BitBagSyliusWishlistPlugin/shop/wishlist/index/content/form/sections/actions/bulk/download_pdf.html.twig"
5176
priority: 0
5277

5378
'bitbag_sylius_wishlist_plugin.wishlist.index.content.form.sections.items':
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% set wishlist = hookable_metadata.context.wishlist %}
2+
3+
<div class="dropdown bb-dropdown">
4+
<button type="button" class="btn btn-light bb-collective-actions disabled" data-bs-toggle="dropdown">
5+
{{ ux_icon('mingcute:down-fill') }}
6+
<span class="text">{{ 'sylius.ui.bulk_actions'|trans }}</span>
7+
</button>
8+
<div class="dropdown-menu">
9+
{% hook 'bulk' with { wishlist } %}
10+
</div>
11+
</div>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% set wishlist = hookable_metadata.context.wishlist %}
2+
3+
<div class="dropdown-item">
4+
<button type="submit" class="btn btn-light w-100" {{ sylius_test_html_attribute('wishlist-add-selected-to-cart') }} formaction="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_add_selected_products', { wishlistId: wishlist.id }) }}">
5+
{{ ux_icon('mdi:cart') }}
6+
{{ 'bitbag_sylius_wishlist_plugin.ui.add_to_cart'|trans }}
7+
</button>
8+
</div>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{% set wishlist = hookable_metadata.context.wishlist %}
2+
3+
{% if app.user %}
4+
{% set wishlists = findAllByShopUserAndToken(app.user) %}
5+
{% else %}
6+
{% set wishlists = findAllByAnonymous() %}
7+
{% endif %}
8+
9+
{% if wishlists|length > 1 %}
10+
<div class="dropdown-item">
11+
<button type="submit" class="btn btn-light w-100" {{ sylius_test_html_attribute('wishlist-copy-to-wishlist') }}
12+
data-bb-wl-list-modal-target="choose-wishlist-button"
13+
data-bb-wl-list-modal-title="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_copy_title'|trans }}"
14+
data-bb-wl-list-modal-perform="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_copy_perform'|trans }}"
15+
data-bb-wl-list-modal-cancel="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_copy_cancel'|trans }}"
16+
data-bb-wl-list-modal-placeholder="{{ 'bitbag_sylius_wishlist_plugin.ui.wishlist_modal_placeholder'|trans }}"
17+
>
18+
{{ ux_icon('mingcute:copy-line') }}
19+
{{ 'bitbag_sylius_wishlist_plugin.ui.copy_to_wishlist'|trans }}
20+
</button>
21+
</div>
22+
{% endif %}
23+
<input type="hidden" data-bb-current-wishlist-id="{{ wishlist.id }}">
24+
{% for wishlistTarget in wishlists %}
25+
{% if wishlist.id != wishlistTarget.id %}
26+
<input type="hidden" data-bb-wishlists="{{ wishlistTarget.name }}" data-bb-wishlists-id="{{ wishlistTarget.id }}">
27+
{% endif %}
28+
{% endfor %}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% set wishlist = hookable_metadata.context.wishlist %}
2+
3+
<div class="dropdown-item">
4+
<button type="submit" class="btn btn-light w-100" {{ sylius_test_html_attribute('wishlist-export-to-csv') }} formaction="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlsit_export_selected_products_to_csv', { wishlistId: wishlist.id }) }}">
5+
{{ ux_icon('material-symbols:download') }}
6+
{{ 'bitbag_sylius_wishlist_plugin.ui.export_to_csv'|trans }}
7+
</button>
8+
</div>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% set wishlist = hookable_metadata.context.wishlist %}
2+
3+
<div class="dropdown-item">
4+
<button type="submit" class="btn btn-light w-100" {{ sylius_test_html_attribute('wishlist-export-to-pdf-from-wishlist') }} formaction="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_export_to_pdf', { wishlistId: wishlist.id }) }}">
5+
{{ ux_icon('material-symbols:download') }}
6+
{{ 'bitbag_sylius_wishlist_plugin.ui.export_wishlist_to_pdf'|trans }}
7+
</button>
8+
</div>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% set wishlist = hookable_metadata.context.wishlist %}
2+
3+
<div class="dropdown-item">
4+
<button type="submit" class="btn btn-light w-100" {{ sylius_test_html_attribute('wishlist-remove-selected-from-wishlist') }} formaction="{{ path('bitbag_sylius_wishlist_plugin_shop_locale_wishlist_remove_selected_products', { wishlistId: wishlist.id }) }}">
5+
{{ ux_icon('mdi:remove') }}
6+
{{ 'bitbag_sylius_wishlist_plugin.ui.remove'|trans }}
7+
</button>
8+
</div>

src/Resources/views/shop/wishlist/index/content/form/sections/actions/collective_actions.html.twig

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)