{#
/*
* This file is part of the ProductReview plugin
*
* Copyright (C) 2016 LOCKON CO.,LTD. All Rights Reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#}
{% import _self as stars %}
{# 星テキスト生成用マクロ #}
{% macro stars(positive, negative) %}
{% set positive_stars = ["", "★", "★★", "★★★", "★★★★", "★★★★★"] %}
{% set negative_stars = ["", "☆", "☆☆", "☆☆☆", "☆☆☆☆", "☆☆☆☆☆"] %}
{{ positive_stars[positive] }}{{ negative_stars[negative] }}
{% endmacro %}
<script>
$(function() {
$('#product_review_area').appendTo($('.ec-layoutRole__main, .ec-layoutRole__mainWithColumn, .ec-layoutRole__mainBetweenColumn'));
$('#product_review_area .ec-rectHeading').on('click', function() {
$content = $('#reviewContent');
if ($content.css('display') == 'none') {
$(this).addClass('is_active');
$content.addClass('is_active');
$content.slideDown(300);
} else {
$(this).removeClass('is_active');
$content.removeClass('is_active');
$content.slideUp(300);
}
return false;
});
});
</script>
<!--▼レビューエリア-->
<div id="product_review_area">
<div class="ec-role">
{% set positive_avg_star = ProductReviewAvg %}
{% set negative_avg_star = 5 - positive_avg_star %}
<div class="_top">
<p class="ec-rectHeading is_active">
<span>{{ 'product_review.front.product_detail.title'|trans }}</span>
<!--平均の星の数-->
<span class="recommend_average">{{ stars.stars(positive_avg_star, negative_avg_star) }}</span>
<!--レビュー数-->
<span>({{ ProductReviewCount }})</span>
{# <span class="chevron pull-right">
<i class="fas fa-angle-up fa-lg"></i>
</span> #}
</p>
<span class="_btn">
<a href="{{ url('product_review_index', { id: Product.id }) }}" class="ec-inlineBtn--action">レビューを書く</a>
</span>
</div>
<div id="reviewContent">
{% if ProductReviews %}
<ul class="review_list">
{% for ProductReview in ProductReviews %}
<li>
<!--星の数-->
{% set positive_star = ProductReview.recommend_level %}
{% set negative_star = 5 - positive_star %}
<p class="recommend_level">
{{ stars.stars(positive_star, negative_star) }}
</p>
<!--タイトル-->
<p class="_title">{{ ProductReview.title }}</p>
<p class="recommend_name">
<span>
{% if ProductReview.reviewer_url %}
<a href="{{ ProductReview.reviewer_url }}" rel="ugc nofollow"
target="_blank">{{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}</a>
{% else %}
{{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}
{% endif %}
</span>
<span class="review_date">
<!--投稿日-->
{{ ProductReview.create_date|date_day }}
</span>
</p>
<!--レビューコメント-->
<p class="_des">{{ ProductReview.comment|nl2br }}</p>
</li>
{% endfor %}
</ul>
{% else %}
<p>{{ 'product_review.front.product_detail.no_review'|trans }}</p>
{% endif %}
</div>
</div>
</div>
<!-- ▲レビューエリア -->