From f5fc9364ab25e2e0d09450c281aa6110a435a710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Ste=CC=A8pien=CC=81?= Date: Fri, 6 Oct 2023 12:29:31 +0200 Subject: [PATCH] Form initial changes --- _dev/js/theme/components/form.js | 14 +- .../views/templates/widget/contactform.tpl | 12 +- .../templates/hook/post-comment-modal.tpl | 6 +- .../hook/product-comment-item-prototype.tpl | 2 +- .../views/templates/hook/product-modal.tpl | 2 +- .../templates/hook/displayGDPRConsent.tpl | 2 +- templates/_partials/form-fields.tpl | 236 +++++++++++------- .../_partials/cart-detailed-product-line.tpl | 2 +- .../_partials/cart-summary-product-line.tpl | 4 +- templates/checkout/_partials/cart-voucher.tpl | 2 +- .../checkout/_partials/customer-form.tpl | 2 +- .../checkout/_partials/steps/shipping.tpl | 4 +- .../_partials/account-transformation-form.tpl | 2 +- .../_partials/order-details-return-modal.tpl | 2 +- .../_partials/order-details-return-table.tpl | 2 +- .../customer/_partials/order-messages.tpl | 4 +- .../customer/_partials/product-table-line.tpl | 2 +- templates/customer/discount.tpl | 2 +- templates/customer/guest-login.tpl | 4 +- templates/customer/history.tpl | 2 +- templates/customer/password-email.tpl | 2 +- templates/customer/password-new.tpl | 4 +- 22 files changed, 177 insertions(+), 137 deletions(-) diff --git a/_dev/js/theme/components/form.js b/_dev/js/theme/components/form.js index 2be7dde0..2134e7d1 100644 --- a/_dev/js/theme/components/form.js +++ b/_dev/js/theme/components/form.js @@ -19,20 +19,10 @@ const supportedValidity = () => { export default class Form { static init() { - Form.parentFocus(); Form.togglePasswordVisibility(); Form.formValidation(); } - static parentFocus() { - $('.js-child-focus').on('focus', ({ target }) => { - $(target).closest('.js-parent-focus').addClass('focus'); - }); - $('.js-child-focus').on('focusout', ({ target }) => { - $(target).closest('.js-parent-focus').removeClass('focus'); - }); - } - static togglePasswordVisibility() { $('[data-action="show-password"]').on('click', (e) => { e.preventDefault(); @@ -40,8 +30,8 @@ export default class Form { const $btn = $(e.currentTarget); const $input = $btn - .closest('.input-group') - .children('input.js-visible-password'); + .closest('.js-parent-focus') + .find('.js-visible-password'); if ($input.attr('type') === 'password') { $input.attr('type', 'text'); diff --git a/modules/contactform/views/templates/widget/contactform.tpl b/modules/contactform/views/templates/widget/contactform.tpl index 7343c7c4..3df717bb 100644 --- a/modules/contactform/views/templates/widget/contactform.tpl +++ b/modules/contactform/views/templates/widget/contactform.tpl @@ -46,7 +46,7 @@ {if !$notifications || $notifications.nw_error}
-
+
-
+
{if $contact.orders} -
+
diff --git a/modules/productcomments/views/templates/hook/product-comment-item-prototype.tpl b/modules/productcomments/views/templates/hook/product-comment-item-prototype.tpl index 3104ebfb..703bcca1 100644 --- a/modules/productcomments/views/templates/hook/product-comment-item-prototype.tpl +++ b/modules/productcomments/views/templates/hook/product-comment-item-prototype.tpl @@ -25,7 +25,7 @@
-
+
@CUSTOMER_NAME@
{*
diff --git a/modules/ps_emailalerts/views/templates/hook/product-modal.tpl b/modules/ps_emailalerts/views/templates/hook/product-modal.tpl index 425f564c..03cc6188 100644 --- a/modules/ps_emailalerts/views/templates/hook/product-modal.tpl +++ b/modules/ps_emailalerts/views/templates/hook/product-modal.tpl @@ -22,7 +22,7 @@

{l s='Sign up and get notification when product will be available again.' d='Shop.Theme.Catalog'}

-
+
+
diff --git a/templates/customer/_partials/order-details-return-table.tpl b/templates/customer/_partials/order-details-return-table.tpl index e90821c3..b4023d58 100644 --- a/templates/customer/_partials/order-details-return-table.tpl +++ b/templates/customer/_partials/order-details-return-table.tpl @@ -91,7 +91,7 @@ diff --git a/templates/customer/_partials/order-messages.tpl b/templates/customer/_partials/order-messages.tpl index 416f5cb9..4c87cf98 100644 --- a/templates/customer/_partials/order-messages.tpl +++ b/templates/customer/_partials/order-messages.tpl @@ -55,7 +55,7 @@

{l s='If you would like to add a comment about your order, please write it in the field below.' d='Shop.Theme.Customeraccount'}

-
+
-
+
diff --git a/templates/customer/_partials/product-table-line.tpl b/templates/customer/_partials/product-table-line.tpl index 8a1cb5cb..ddafa8e3 100644 --- a/templates/customer/_partials/product-table-line.tpl +++ b/templates/customer/_partials/product-table-line.tpl @@ -38,7 +38,7 @@
    {foreach from=$product.attributes key="attribute" item="value"}
  • - {$attribute}: {$value} + {$attribute}: {$value}
  • {/foreach}
diff --git a/templates/customer/discount.tpl b/templates/customer/discount.tpl index 2985df35..de07a8c4 100644 --- a/templates/customer/discount.tpl +++ b/templates/customer/discount.tpl @@ -49,7 +49,7 @@ {$cart_rule.name} {$cart_rule.quantity_for_user} - + {$cart_rule.value} diff --git a/templates/customer/guest-login.tpl b/templates/customer/guest-login.tpl index cd9fae33..a1a2759a 100644 --- a/templates/customer/guest-login.tpl +++ b/templates/customer/guest-login.tpl @@ -37,7 +37,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
diff --git a/templates/customer/history.tpl b/templates/customer/history.tpl index 0c3821ff..8c88d217 100644 --- a/templates/customer/history.tpl +++ b/templates/customer/history.tpl @@ -53,7 +53,7 @@ - + {$order.totals.total.value} diff --git a/templates/customer/password-email.tpl b/templates/customer/password-email.tpl index b80241d2..963de1e5 100644 --- a/templates/customer/password-email.tpl +++ b/templates/customer/password-email.tpl @@ -45,7 +45,7 @@
-
+
diff --git a/templates/customer/password-new.tpl b/templates/customer/password-new.tpl index 47f053e4..92e45003 100644 --- a/templates/customer/password-new.tpl +++ b/templates/customer/password-new.tpl @@ -46,12 +46,12 @@ sprintf=['%email%' => $customer_email|stripslashes]}

-
+
-
+