diff --git a/features/assigning_wishlist_to_user.feature b/features/assigning_wishlist_to_user.feature index 3329153e..9d9137fa 100644 --- a/features/assigning_wishlist_to_user.feature +++ b/features/assigning_wishlist_to_user.feature @@ -42,18 +42,3 @@ Feature: Assigning a wishlist to a user Then I should have 0 wishlists And I should not see "Wishlist-assigned" - @ui @javascript - Scenario: Logout without assigning a wishlist to a user - Given the store has a product "Jack Daniels Gentleman" priced at "$10.00" - And all store products appear under a main taxonomy - And I add this product to wishlist - When I go to "/" - And I log in as "jdeer@sylius.pl" - And I go to "/wishlists" - And I press "wishlist-edit-button-Wishlist" - And I fill in "edit_wishlist_name" with "Wishlist-not-assigned" - And I press "edit_wishlist_save" - And I log out - And I go to "/wishlists" - Then I should have 1 wishlists - And I should see "Wishlist-not-assigned" diff --git a/src/Resources/assets/shop/js/copyToWishlistsListModal.js b/src/Resources/assets/shop/js/copyToWishlistsListModal.js index 1e66fe45..d52c58a0 100644 --- a/src/Resources/assets/shop/js/copyToWishlistsListModal.js +++ b/src/Resources/assets/shop/js/copyToWishlistsListModal.js @@ -11,6 +11,7 @@ export class CreateCopyToWishlistsListModal { headerTitle: 'Choose a wishlist to which selected items should be copied', cancelText: 'cancel', performText: 'perform', + wishlistSelectionPlaceholder: 'My Wishlist…', datasetWishlistTargets: '[data-bb-wishlists]', datasetWishlistTargetsId: '[data-bb-wishlists-id]', datasetWishlistCurrentId: '[data-bb-current-wishlist-id]', @@ -86,7 +87,7 @@ export class CreateCopyToWishlistsListModal { const select = document.createElement('select') select.name = 'wishlist' select.classList.add('ui', 'selection', 'dropdown') - select.insertAdjacentHTML("beforeend" ,'') + select.insertAdjacentHTML("beforeend" ,``) this.wishlistTargets.forEach(wishlist => { select.insertAdjacentHTML("beforeend" , this._wishlistTemplate(wishlist)) diff --git a/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js b/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js index c2cf039c..5745939b 100644 --- a/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js +++ b/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js @@ -7,11 +7,13 @@ const setWishlistModal = () => { addWishlistBtn.addEventListener('click', () => { new WishlistModal( { - headerTitle: 'Choose name for your new wishlist', + headerTitle: document.querySelector("[data-bb-wishlist-add-title]").dataset.bbWishlistAddTitle, + cancelText: document.querySelector("[data-bb-wishlist-add-cancel]").dataset.bbWishlistAddCancel, + performText: document.querySelector("[data-bb-wishlist-add-perform]").dataset.bbWishlistAddPerform, wishlistFormName: wishlistFormName, wishlistBodyContent: ` -
+ ` }, { diff --git a/src/Resources/assets/shop/js/handleCopyToWishlistListModal.js b/src/Resources/assets/shop/js/handleCopyToWishlistListModal.js index ff26a251..10688573 100644 --- a/src/Resources/assets/shop/js/handleCopyToWishlistListModal.js +++ b/src/Resources/assets/shop/js/handleCopyToWishlistListModal.js @@ -6,7 +6,12 @@ const setAddWishlistModal = () => { e.preventDefault(); new CreateCopyToWishlistsListModal( - {}, + { + headerTitle: document.querySelector("[data-bb-wl-list-modal-title]").dataset.bbWlListModalTitle, + cancelText: document.querySelector("[data-bb-wl-list-modal-cancel]").dataset.bbWlListModalCancel, + performText: document.querySelector("[data-bb-wl-list-modal-perform]").dataset.bbWlListModalPerform, + wishlistSelectionPlaceholder: document.querySelector("[data-bb-wl-list-modal-placeholder]").dataset.bbWlListModalPlaceholder, + }, { cancelAction: () => {}, performAction: async () => { diff --git a/src/Resources/assets/shop/js/handleEditWishlistModal.js b/src/Resources/assets/shop/js/handleEditWishlistModal.js index 9c994a96..631dc033 100644 --- a/src/Resources/assets/shop/js/handleEditWishlistModal.js +++ b/src/Resources/assets/shop/js/handleEditWishlistModal.js @@ -8,11 +8,13 @@ const setWishlistModal = () => { btn.addEventListener('click', () => { new WishlistModal( { - headerTitle: 'Choose new name for your wishlist', + headerTitle: btn.dataset.wishlistEditTitle, + cancelText: btn.dataset.wishlistEditCancel, + performText: btn.dataset.wishlistEditPerform, wishlistFormName: wishlistFormName, wishlistBodyContent: ` - + ` }, { diff --git a/src/Resources/assets/shop/js/handleRemoveWishlistModal.js b/src/Resources/assets/shop/js/handleRemoveWishlistModal.js index 533d40fb..90b88388 100644 --- a/src/Resources/assets/shop/js/handleRemoveWishlistModal.js +++ b/src/Resources/assets/shop/js/handleRemoveWishlistModal.js @@ -8,9 +8,11 @@ const setWishlistModal = () => { btn.addEventListener('click', () => { new WishlistModal( { - headerTitle: 'Remove wishlist', + headerTitle: btn.dataset.wishlistRemoveTitle, wishlistFormName: wishlistFormName, - wishlistBodyContent: 'Are you sure?' + wishlistBodyContent: btn.dataset.wishlistRemoveContent, + performText: btn.dataset.wishlistRemovePerform, + cancelText: btn.dataset.wishlistRemoveCancel }, { cancelAction: () => {}, diff --git a/src/Resources/assets/shop/js/index.js b/src/Resources/assets/shop/js/index.js index 1df8ace8..4a298c62 100644 --- a/src/Resources/assets/shop/js/index.js +++ b/src/Resources/assets/shop/js/index.js @@ -6,6 +6,7 @@ import './handleEditWishlistModal'; import { WishlistVariantButton } from './WishlistVariantButton'; import { WishlistVariantPrice } from './WishlistVariantPrice'; + const WishlistVariantElements = [...document.querySelectorAll('[data-bb-toggle="wishlist-variant"]')]; export const WishlistVariantButtonList = WishlistVariantElements.map(button => new WishlistVariantButton(button).init()); diff --git a/src/Resources/assets/shop/js/wishlistModal.js b/src/Resources/assets/shop/js/wishlistModal.js index 3911ab2a..072554f4 100644 --- a/src/Resources/assets/shop/js/wishlistModal.js +++ b/src/Resources/assets/shop/js/wishlistModal.js @@ -74,6 +74,7 @@ export class WishlistModal { _modalActions(template) { const cancelBtn = template.querySelector('[data-bb-action="cancel"]'); const confirmBtn = template.querySelector('[data-bb-action="perform"]'); + const input = template.querySelector('[data-bb-target="wishlists"] > [data-bb-target="input"]'); cancelBtn.addEventListener('click', () => { this.actions.cancelAction(); @@ -90,6 +91,15 @@ export class WishlistModal { this.actions.performAction(); this._closeModal(); }); + + if (input) { + input.addEventListener("keypress", function(event) { + if (event.key === "Enter") { + event.preventDefault(); + confirmBtn.click(); + } + }); + } } _isInputValid(template) { diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml index 8c926019..44cdb9ea 100644 --- a/src/Resources/translations/messages.en.yml +++ b/src/Resources/translations/messages.en.yml @@ -47,3 +47,19 @@ bitbag_sylius_wishlist_plugin: wishlist_saved: Wishlist has been saved. you_have_no_access_to_that_wishlist: You have no access to that wishlist. wishlist_has_product_variant: '%productName% variant is already in wishlist.' + wishlist_modal_copy_title: 'Choose a wishlist to which selected items should be copied' + wishlist_modal_copy_cancel: 'cancel' + wishlist_modal_copy_perform: 'perform' + wishlist_modal_add_title: 'Choose name for your new wishlist' + wishlist_modal_add_perform: 'perform' + wishlist_modal_add_cancel: 'cancel' + wishlist_modal_add_error: 'Please enter wishlist name.' + wishlist_modal_edit_title: 'Choose new name for your wishlist' + wishlist_modal_edit_error: 'Please enter wishlist name.' + wishlist_modal_edit_perform: 'perform' + wishlist_modal_edit_cancel: 'cancel' + wishlist_modal_remove_title: 'Remove wishlist' + wishlist_modal_remove_content: 'Are you sure?' + wishlist_modal_remove_perform: 'perform' + wishlist_modal_remove_cancel: 'cancel' + wishlist_modal_placeholder: 'My wishlists...' diff --git a/src/Resources/views/WishlistDetails/_collectiveActions.html.twig b/src/Resources/views/WishlistDetails/_collectiveActions.html.twig index ca039313..e2fb2a80 100644 --- a/src/Resources/views/WishlistDetails/_collectiveActions.html.twig +++ b/src/Resources/views/WishlistDetails/_collectiveActions.html.twig @@ -21,7 +21,13 @@ {% if wishlists|length > 1 %}