diff --git a/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js b/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js index b6c7dbb5..c2cf039c 100644 --- a/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js +++ b/src/Resources/assets/shop/js/handleAddAnotherWishlistModal.js @@ -20,7 +20,7 @@ const setWishlistModal = () => { const form = document.querySelector(`#${wishlistFormName}`); const formValue = form.querySelector(`#${wishlistFormName}_name`); - const url = '/wishlists/create'; + const url = document.querySelector("[data-bb-wishlist-add-url]").dataset.bbWishlistAddUrl; const formData = new FormData(form); const csrfToken = document.querySelector("[data-bb-csrf]").dataset.bbCsrf; diff --git a/src/Resources/config/routing.yml b/src/Resources/config/routing.yml index 0b40037c..c4d73cb8 100644 --- a/src/Resources/config/routing.yml +++ b/src/Resources/config/routing.yml @@ -1,115 +1,5 @@ -bitbag_sylius_wishlist_plugin_shop_wishlist_list_products: - path: /wishlist - methods: [GET] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.list_wishlist_products - -bitbag_sylius_wishlist_plugin_shop_wishlist_add_products: - path: /wishlist/{wishlistId}/products - methods: [POST] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.add_products_to_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_add_product: - path: /wishlist/add/{productId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.add_product_to_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_remove_product: - path: /wishlist/remove/{productId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.remove_product_from_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_remove_selected_products: - path: /wishlist/{wishlistId}/products/delete - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.remove_selected_products_from_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_add_product_variant: - path: /wishlist/{wishlistId}/add/variant/{variantId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.add_product_variant_to_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_add_selected_products: - path: /wishlist/{wishlistId}/products/add - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.add_selected_products_to_cart - -bitbag_sylius_wishlist_plugin_shop_wishlsit_export_selected_products_to_csv: - path: /wishlist/{wishlistId}/csv/export - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.export_selected_products_to_csv - -bitbag_sylius_wishlist_plugin_shop_wishlist_import_from_csv: - path: /wishlist/csv/import - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.import_from_csv - -bitbag_sylius_wishlist_plugin_shop_wishlist_remove_product_variant: - path: /wishlist/{wishlistId}/remove/variant/{variantId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.remove_product_variant_from_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_render_header_template: - path: /wishlist/header-template - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.render_header_template - -bitbag_sylius_wishlist_plugin_shop_wishlist_export_to_pdf: - path: /wishlist/{wishlistId}/export/pdf - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.export_wishlist_to_pdf_action - -bitbag_sylius_wishlist_plugin_shop_wishlist_clean: - path: /wishlist/clear/{wishlistId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.clean_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_create_new_wishlist: - path: /wishlists/create - methods: [GET, POST, DELETE] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.create_new_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_remove_wishlist: - path: /wishlists/{id}/remove - methods: [GET, POST, DELETE] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.wishlist::deleteAction - _sylius: - csrf_protection: false - redirect: - route: bitbag_sylius_wishlist_plugin_shop_wishlist_list_wishlists - -bitbag_sylius_wishlist_plugin_shop_wishlist_edit_wishlist_name: - path: /wishlists/{id}/edit - methods: [GET, PUT, POST] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.update_wishlist_name_action - -bitbag_sylius_wishlist_plugin_shop_wishlist_list_wishlists: - path: /wishlists - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.list_wishlists - -bitbag_sylius_wishlist_plugin_shop_wishlist_show_chosen_wishlist: - path: /wishlists/{wishlistId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.show_chosen_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_add_product_to_selected_wishlist: - path: /wishlist/{wishlistId}/add/{productId} - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.add_product_to_selected_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_copy_selected_products_to_other_wishlist: - path: /wishlists/{wishlistId}/copy/{destinedWishlistId} - methods: [ POST ] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.copy_selected_products_to_other_wishlist - -bitbag_sylius_wishlist_plugin_shop_wishlist_add_wishlist_to_user: - path: /wishlists/{id}/save-wishlist - methods: [GET, PUT, POST] - defaults: - _controller: bitbag_sylius_wishlist_plugin.controller.action.add_wishlists_to_user +bitbag_sylius_wishlist_plugin_shop: + resource: "@BitBagSyliusWishlistPlugin/Resources/config/routing/shop.yml" + prefix: /{_locale} + requirements: + _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ diff --git a/src/Resources/config/routing/shop.yml b/src/Resources/config/routing/shop.yml new file mode 100644 index 00000000..0b40037c --- /dev/null +++ b/src/Resources/config/routing/shop.yml @@ -0,0 +1,115 @@ +bitbag_sylius_wishlist_plugin_shop_wishlist_list_products: + path: /wishlist + methods: [GET] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.list_wishlist_products + +bitbag_sylius_wishlist_plugin_shop_wishlist_add_products: + path: /wishlist/{wishlistId}/products + methods: [POST] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.add_products_to_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_add_product: + path: /wishlist/add/{productId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.add_product_to_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_remove_product: + path: /wishlist/remove/{productId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.remove_product_from_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_remove_selected_products: + path: /wishlist/{wishlistId}/products/delete + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.remove_selected_products_from_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_add_product_variant: + path: /wishlist/{wishlistId}/add/variant/{variantId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.add_product_variant_to_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_add_selected_products: + path: /wishlist/{wishlistId}/products/add + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.add_selected_products_to_cart + +bitbag_sylius_wishlist_plugin_shop_wishlsit_export_selected_products_to_csv: + path: /wishlist/{wishlistId}/csv/export + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.export_selected_products_to_csv + +bitbag_sylius_wishlist_plugin_shop_wishlist_import_from_csv: + path: /wishlist/csv/import + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.import_from_csv + +bitbag_sylius_wishlist_plugin_shop_wishlist_remove_product_variant: + path: /wishlist/{wishlistId}/remove/variant/{variantId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.remove_product_variant_from_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_render_header_template: + path: /wishlist/header-template + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.render_header_template + +bitbag_sylius_wishlist_plugin_shop_wishlist_export_to_pdf: + path: /wishlist/{wishlistId}/export/pdf + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.export_wishlist_to_pdf_action + +bitbag_sylius_wishlist_plugin_shop_wishlist_clean: + path: /wishlist/clear/{wishlistId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.clean_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_create_new_wishlist: + path: /wishlists/create + methods: [GET, POST, DELETE] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.create_new_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_remove_wishlist: + path: /wishlists/{id}/remove + methods: [GET, POST, DELETE] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.wishlist::deleteAction + _sylius: + csrf_protection: false + redirect: + route: bitbag_sylius_wishlist_plugin_shop_wishlist_list_wishlists + +bitbag_sylius_wishlist_plugin_shop_wishlist_edit_wishlist_name: + path: /wishlists/{id}/edit + methods: [GET, PUT, POST] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.update_wishlist_name_action + +bitbag_sylius_wishlist_plugin_shop_wishlist_list_wishlists: + path: /wishlists + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.list_wishlists + +bitbag_sylius_wishlist_plugin_shop_wishlist_show_chosen_wishlist: + path: /wishlists/{wishlistId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.show_chosen_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_add_product_to_selected_wishlist: + path: /wishlist/{wishlistId}/add/{productId} + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.add_product_to_selected_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_copy_selected_products_to_other_wishlist: + path: /wishlists/{wishlistId}/copy/{destinedWishlistId} + methods: [ POST ] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.copy_selected_products_to_other_wishlist + +bitbag_sylius_wishlist_plugin_shop_wishlist_add_wishlist_to_user: + path: /wishlists/{id}/save-wishlist + methods: [GET, PUT, POST] + defaults: + _controller: bitbag_sylius_wishlist_plugin.controller.action.add_wishlists_to_user diff --git a/src/Resources/views/WishlistDetails/index.html.twig b/src/Resources/views/WishlistDetails/index.html.twig index a304cec9..ae551ecf 100644 --- a/src/Resources/views/WishlistDetails/index.html.twig +++ b/src/Resources/views/WishlistDetails/index.html.twig @@ -17,7 +17,7 @@ {% if wishlists|length > 1 %} {% else %}