Skip to content

Commit

Permalink
Merge pull request #640 from tblivet/issue-494
Browse files Browse the repository at this point in the history
Fix: issue-494
  • Loading branch information
tblivet authored Jun 26, 2024
2 parents 3da316f + fff3128 commit 1d6a9e8
Show file tree
Hide file tree
Showing 12 changed files with 647 additions and 271 deletions.
16 changes: 9 additions & 7 deletions modules/productcomments/views/templates/hook/alert-modal.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file that was distributed with this source code.
*}

{assign var='icon' value=$icon|default:'check_circle'}
{assign var='icon' value=$icon|default:'check'}
{assign var='modal_message' value=$modal_message|default:''}

<script type="text/javascript">
Expand All @@ -19,22 +19,24 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<p class="h2">
<p class="h2 mb-0">
<i class="material-icons {$icon}" data-icon="{$icon}"></i>
{$modal_title}
</p>
</div>

<div class="modal-body">
<div class="row">
<div class="col-md-12 col-sm-12" id="{$modal_id}-message">
{$modal_message}
</div>
</div>
<div class="modal-footer post-comment-buttons">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" aria-label="{l s='OK' d='Modules.Productcomments.Shop'}">
{l s='OK' d='Modules.Productcomments.Shop'}
</button>
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" aria-label="{l s='OK' d='Modules.Productcomments.Shop'}">
{l s='OK' d='Modules.Productcomments.Shop'}
</button>
</div>
</div>
</div>
Expand Down
22 changes: 11 additions & 11 deletions modules/productcomments/views/templates/hook/confirm-modal.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file that was distributed with this source code.
*}

{assign var='icon' value=$icon|default:'check_circle'}
{assign var='icon' value=$icon|default:'check'}
{assign var='modal_message' value=$modal_message|default:''}

<script type="text/javascript">
Expand Down Expand Up @@ -32,20 +32,20 @@
{$modal_title}
</p>
</div>

<div class="modal-body">
<div id="{$modal_id}-message">
{$modal_message}
</div>
<div class="modal-footer">
<div class="post-comment-buttons">
<button type="button" class="btn btn-outline-primary me-2 refuse-button" data-bs-dismiss="modal" aria-label="{l s='No' d='Modules.Productcomments.Shop'}">
{l s='No' d='Modules.Productcomments.Shop'}
</button>
<button type="button" class="btn btn-primary confirm-button" data-bs-dismiss="modal" aria-label="{l s='Yes' d='Modules.Productcomments.Shop'}">
{l s='Yes' d='Modules.Productcomments.Shop'}
</button>
</div>
</div>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-outline-primary me-2 refuse-button" data-bs-dismiss="modal" aria-label="{l s='No' d='Modules.Productcomments.Shop'}">
{l s='No' d='Modules.Productcomments.Shop'}
</button>
<button type="button" class="btn btn-primary confirm-button" data-bs-dismiss="modal" aria-label="{l s='Yes' d='Modules.Productcomments.Shop'}">
{l s='Yes' d='Modules.Productcomments.Shop'}
</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<div id="empty-product-comment" class="product-comment-list-item py-3">
{if $post_allowed}
<button class="btn btn-primary btn-with-icon post-product-comment">
<button class="btn btn-outline-primary btn-with-icon post-product-comment">
<i class="material-icons" aria-hidden="true">&#xE3C9;</i>
{l s='Be the first to write your review' d='Modules.Productcomments.Shop'}
</button>
Expand Down
261 changes: 130 additions & 131 deletions modules/productcomments/views/templates/hook/post-comment-modal.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,160 +11,159 @@

<div id="post-product-comment-modal" class="modal fade product-comment-modal" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form class="modal-content" id="post-product-comment-form" action="{$post_comment_url nofilter}" method="POST">
<div class="modal-header">
<p class="h4 mb-0">{l s='Write your review' d='Modules.Productcomments.Shop'}</p>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="post-product-comment-form" action="{$post_comment_url nofilter}" method="POST">
<div class="row">
<div class="col-5 col-sm-2 mb-4">
{if isset($product) && $product}
{block name='product_flags'}
<ul class="product-flags">
{foreach from=$product.flags item=flag}
<li class="product-flag {$flag.type}">{$flag.label}</li>
{/foreach}
</ul>
{/block}

{block name='product_cover'}
<div class="product-cover">
{if !empty($product.cover)}
<picture>
{if isset($product.cover.bySize.default_xs.sources.avif)}
<source
srcset="
{$product.cover.bySize.default_xs.sources.avif},
{$product.cover.bySize.default_m.sources.avif} 2x"
type="image/avif"
>
{/if}

{if isset($product.cover.bySize.default_xs.sources.webp)}
<source
srcset="
{$product.cover.bySize.default_xs.sources.webp},
{$product.cover.bySize.default_m.sources.webp} 2x"
type="image/webp"
>
{/if}
<div class="modal-body">
<div class="row">
<div class="col-12 col-sm-2 mb-4">
{if isset($product) && $product}
{block name='product_cover'}
<div class="product__cover">
{if !empty($product.cover)}
<picture>
{if isset($product.cover.bySize.default_xs.sources.avif)}
<source
srcset="
{$product.cover.bySize.default_xs.sources.avif},
{$product.cover.bySize.default_m.sources.avif} 2x"
type="image/avif"
>
{/if}

<img
class="js-qv-product-cover rounded img-fluid"
{if isset($product.cover.bySize.default_xs.sources.webp)}
<source
srcset="
{$product.cover.bySize.default_xs.url},
{$product.cover.bySize.default_m.url} 2x"
loading="lazy"
width="{$product.cover.bySize.default_xs.width}"
height="{$product.cover.bySize.default_xs.height}"
alt="{$product.cover.legend}"
title="{$product.cover.legend}"
{$product.cover.bySize.default_xs.sources.webp},
{$product.cover.bySize.default_m.sources.webp} 2x"
type="image/webp"
>
</picture>
{else}
<picture>
{if isset($urls.no_picture_image.bySize.default_xs.sources.avif)}
<source
srcset="
{$urls.no_picture_image.bySize.default_xs.sources.avif},
{$urls.no_picture_image.bySize.default_m.sources.avif} 2x"
type="image/avif"
>
{/if}
{/if}

{if isset($urls.no_picture_image.bySize.default_xs.sources.webp)}
<source
srcset="
{$urls.no_picture_image.bySize.default_xs.sources.webp},
{$urls.no_picture_image.bySize.default_m.sources.webp} 2x"
type="image/webp"
>
{/if}
<img
class="js-qv-product-cover rounded img-fluid"
srcset="
{$product.cover.bySize.default_xs.url},
{$product.cover.bySize.default_m.url} 2x"
loading="lazy"
width="{$product.cover.bySize.default_xs.width}"
height="{$product.cover.bySize.default_xs.height}"
alt="{$product.cover.legend}"
title="{$product.cover.legend}"
>
</picture>
{else}
<picture>
{if isset($urls.no_picture_image.bySize.default_xs.sources.avif)}
<source
srcset="
{$urls.no_picture_image.bySize.default_xs.sources.avif},
{$urls.no_picture_image.bySize.default_m.sources.avif} 2x"
type="image/avif"
>
{/if}

<img
class="rounded img-fluid"
{if isset($urls.no_picture_image.bySize.default_xs.sources.webp)}
<source
srcset="
{$urls.no_picture_image.bySize.default_xs.url},
{$urls.no_picture_image.bySize.default_m.url} 2x"
width="{$urls.no_picture_image.bySize.default_xs.width}"
height="{$urls.no_picture_image.bySize.default_xs.height}"
loading="lazy"
{$urls.no_picture_image.bySize.default_xs.sources.webp},
{$urls.no_picture_image.bySize.default_m.sources.webp} 2x"
type="image/webp"
>
</picture>
{/if}
</div>
{/block}
{/if}
</div>
<div class="col-7 col-sm-5">
<p class="h5">{$product.name}</p>
{block name='product_description_short'}
<div itemprop="description">{$product.description_short nofilter}</div>
{/block}
</div>
<div class="col-sm-5">
{if $criterions|@count > 0}
<ul id="criterions_list">
{foreach from=$criterions item='criterion'}
<li class="mb-2">
<div class="criterion-rating">
<label>{$criterion.name|escape:'html':'UTF-8'}:</label>
<div
class="grade-stars"
data-grade="3"
data-input="criterion[{$criterion.id_product_comment_criterion}]">
</div>
</div>
</li>
{/foreach}
</ul>
{/if}
</div>
</div>
{/if}

<div class="row">
{if !$logged}
<div class="col-sm-8">
<label class="form-label" for="comment_title">{l s='Title' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<input class="form-control" name="comment_title" type="text" value=""/>
</div>
<div class="col-sm-4">
<label class="form-label" for="customer_name">{l s='Your name' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<input class="form-control" name="customer_name" type="text" value=""/>
</div>
{else}
<div class="mb-3">
<label class="form-label" for="comment_title">{l s='Title' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<input class="form-control" name="comment_title" type="text" value=""/>
</div>
<img
class="rounded img-fluid"
srcset="
{$urls.no_picture_image.bySize.default_xs.url},
{$urls.no_picture_image.bySize.default_m.url} 2x"
width="{$urls.no_picture_image.bySize.default_xs.width}"
height="{$urls.no_picture_image.bySize.default_xs.height}"
loading="lazy"
>
</picture>
{/if}
</div>
{/block}
{/if}
</div>

<div class="mb-3">
<label class="form-label" for="comment_content">{l s='Review' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<textarea class="form-control" name="comment_content"></textarea>
<div class="col-12 col-sm-10">
<p class="product__title">{$product.name}</p>
{block name='product_description_short'}
<div class="product__description" itemprop="description">{$product.description_short nofilter}</div>
{/block}
</div>

<div class="mb-3">
{hook h='displayGDPRConsent' mod='psgdpr' id_module=$id_module}
<div class="col-12">
{if $criterions|@count > 0}
<ul id="criterions_list">
{foreach from=$criterions item='criterion'}
<li class="mb-2">
<div class="criterion-rating">
<label>
{$criterion.name|escape:'html':'UTF-8'}<sup class="required text-danger">*</sup>
</label>

<div
class="grade-stars"
data-grade="3"
data-input="criterion[{$criterion.id_product_comment_criterion}]">
</div>
</div>
</li>
{/foreach}
</ul>
{/if}
</div>
</div>

<div class="modal-footer">
<p class="required"><sup>*</sup> {l s='Required fields' d='Modules.Productcomments.Shop'}</p>
<div class="post-comment-buttons">
<button type="button" class="btn btn-outline-primary me-2" data-bs-dismiss="modal" aria-label="{l s='Cancel' d='Modules.Productcomments.Shop'}">
{l s='Cancel' d='Modules.Productcomments.Shop'}
</button>
<button type="submit" class="btn btn-primary">
{l s='Send' d='Modules.Productcomments.Shop'}
</button>
<div class="row">
{if !$logged}
<div class="col-sm-8 mb-3">
<label class="form-label" for="comment_title">{l s='Title' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<input class="form-control" name="comment_title" type="text" value=""/>
</div>
<div class="col-sm-4 mb-3">
<label class="form-label" for="customer_name">{l s='Your name' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<input class="form-control" name="customer_name" type="text" value=""/>
</div>
{else}
<div class="mb-3">
<label class="form-label" for="comment_title">{l s='Title' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<input class="form-control" name="comment_title" type="text" value=""/>
</div>
{/if}
</div>

<div class="mb-3">
<label class="form-label" for="comment_content">{l s='Review' d='Modules.Productcomments.Shop'}<sup class="required">*</sup></label>
<textarea class="form-control" name="comment_content"></textarea>
</div>

{capture name='gdprContent'}{hook h='displayGDPRConsent' mod='psgdpr' id_module=$id_module}{/capture}
{if $smarty.capture.gdprContent != ''}
<div class="mb-3">
{$smarty.capture.gdprContent nofilter}
</div>
</form>
{/if}
</div>

<div class="modal-footer">
<p><sup>*</sup> {l s='Required fields' d='Modules.Productcomments.Shop'}</p>
<div class="d-flex flex-wrap w-100 w-md-auto">
<button type="button" class="btn btn-outline-primary me-0 me-md-2 w-md-auto w-100" data-bs-dismiss="modal" aria-label="{l s='Cancel' d='Modules.Productcomments.Shop'}">
{l s='Cancel' d='Modules.Productcomments.Shop'}
</button>
<button type="submit" class="btn btn-primary w-md-auto w-100 mb-3 mb-md-0 order-first order-md-last">
{l s='Send' d='Modules.Productcomments.Shop'}
</button>
</div>
</div>
</div>
</form>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="product-comments-additional-info">
{if $nb_comments == 0}
{if $post_allowed}
<button class="btn btn-primary btn-with-icon post-product-comment">
<button class="btn btn-outline-primary btn-with-icon post-product-comment">
<i class="material-icons edit" data-icon="edit"></i>
{l s='Write your review' d='Modules.Productcomments.Shop'}
</button>
Expand Down
Loading

0 comments on commit 1d6a9e8

Please sign in to comment.