Skip to content

Commit

Permalink
Form initial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Oksydan committed Oct 6, 2023
1 parent eaa89c9 commit f5fc936
Show file tree
Hide file tree
Showing 22 changed files with 177 additions and 137 deletions.
14 changes: 2 additions & 12 deletions _dev/js/theme/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,19 @@ 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();
e.stopImmediatePropagation();

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');
Expand Down
12 changes: 6 additions & 6 deletions modules/contactform/views/templates/widget/contactform.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{if !$notifications || $notifications.nw_error}
<section class="form-fields">

<div class="form-group">
<div class="mb-3">
<label class="form-control-label">{l s='Subject' d='Shop.Forms.Labels'}</label>
<select name="id_contact" class="custom-select">
{foreach from=$contact.contacts item=contact_elt}
Expand All @@ -55,7 +55,7 @@
</select>
</div>

<div class="form-group">
<div class="mb-3">
<label class="form-control-label">{l s='Email address' d='Shop.Forms.Labels'}</label>
<input
class="form-control"
Expand All @@ -67,7 +67,7 @@
</div>

{if $contact.orders}
<div class="form-group">
<div class="mb-3">
<label class="form-control-label">{l s='Order reference' d='Shop.Forms.Labels'}</label>
<select name="id_order" class="custom-select">
<option value="">{l s='Select reference' d='Shop.Forms.Help'}</option>
Expand All @@ -82,7 +82,7 @@
{/if}

{if $contact.allow_file_upload}
<div class="form-group">
<div class="mb-3">
<label class="form-control-label">{l s='Attachment' d='Shop.Forms.Labels'}</label>

<div class="custom-file">
Expand All @@ -95,7 +95,7 @@
</div>
{/if}

<div class="form-group">
<div class="mb-3">
<label class="form-control-label">{l s='Message' d='Shop.Forms.Labels'}</label>
<textarea
class="form-control"
Expand All @@ -106,7 +106,7 @@
</div>

{if isset($id_module)}
<div class="form-group">
<div class="mb-3">
{hook h='displayGDPRConsent' id_module=$id_module}
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@
</ul>
{/if}

<div class="form-group">
<div class="mb-3">
<label for="comment_title" class="form-label required">{l s='Title' d='Modules.Productcomments.Shop'}</label>
<input class="form-control" id="comment_title" name="comment_title" type="text" value=""/>
</div>

{if !$logged}
<div class="form-group">
<div class="mb-3">
<label class="form-label required" for="customer_name">{l s='Your name' d='Modules.Productcomments.Shop'}</label>
<input class="form-control" id="customer_name" name="customer_name" type="text" value=""/>
</div>
{/if}

<div class="form-group">
<div class="mb-3">
<label class="form-label required" for="comment_content">{l s='Review' d='Modules.Productcomments.Shop'}</label>
<textarea class="form-control" rows="4" id="comment_content" name="comment_content"></textarea>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<div class="product-comment-list-item pb-4 mb-4 border-bottom" data-product-comment-id="@COMMENT_ID@" data-product-id="@PRODUCT_ID@">
<div class="d-flex mb-2 align-items-center">
<div class="font-weight-bold">
<div class="fw-bold">
@CUSTOMER_NAME@
</div>
{* <div class="text-muted font-sm ms-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<p>
{l s='Sign up and get notification when product will be available again.' d='Shop.Theme.Catalog'}
</p>
<div class="form-group">
<div class="mb-3">
<input
class="form-control js-mailalert-email"
type="email"
Expand Down
2 changes: 1 addition & 1 deletion modules/psgdpr/views/templates/hook/displayGDPRConsent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}

<div id="gdpr_consent" class="gdpr_module_{$psgdpr_id_module|escape:'htmlall':'UTF-8'} form-group">
<div id="gdpr_consent" class="gdpr_module_{$psgdpr_id_module|escape:'htmlall':'UTF-8'} mb-3">
<span class="custom-control custom-checkbox">
<input id="psgdpr_consent_checkbox_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}" name="psgdpr_consent_checkbox" type="checkbox" value="1" class="custom-control-input psgdpr_consent_checkboxes_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}">
<label class="custom-control-label" for="psgdpr_consent_checkbox_{$psgdpr_id_module|escape:'htmlall':'UTF-8'}">
Expand Down
Loading

0 comments on commit f5fc936

Please sign in to comment.