{#
/*
* 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 %}
<style type="text/css">
#product_review_area .review_list .recommend_name {
margin-left: 16px;
}
</style>
<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="ec-rectHeading">
<div class="head_title">この商品に対するお客様の声</div>
<span class="chevron pull-right">
<span>お客様の声を見る</span>
<div class="icon-wrap"><span class="icon"></span></div>
</span>
</div>
<div id="reviewContent">
<div class="reviewContent__inner">
<div class="reviewContent_left">
<p class="reviewContent_left__ttl">カスタマーレビュー</p>
<div class="recommend_wrap">
<!--平均の星の数-->
<span class="recommend_average">{{ stars.stars(positive_avg_star, negative_avg_star) }}</span>
<!--レビュー数-->
<span class="recommend_average__bottom">({{ ProductReviewCount }})件の評価</span>
</div>
<div class="btn_wrap">
<a href="{{ url('product_review_index', { id: Product.id }) }}"
class="review_write_btn">この商品のレビューを書く</a>
</div>
</div><!--/.reviewContent_left-->
{% if ProductReviews %}
<ul class="review_list">
{% for ProductReview in ProductReviews %}
<li>
<!--タイトル-->
<p class="review_list_ttl">{{ ProductReview.title }}</p>
<p class="review_date">
<!--星の数-->
{% set positive_star = ProductReview.recommend_level %}
{% set negative_star = 5 - positive_star %}
<span class="recommend_level">{{ stars.stars(positive_star, negative_star) }}</span>
<span class="review_date__right">
<!--投稿日-->
<span class="review_date__wrap">投稿日:<span class="review_date_txt">{{ ProductReview.create_date|date_day }}</span></span>
<!--投稿者-->
<span class="recommend_name">
{% 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>
</p>
<!--レビューコメント-->
<p>{{ ProductReview.comment|nl2br }}</p>
</li>
{% endfor %}
</ul>
{% else %}
<p>{{ 'product_review.front.product_detail.no_review'|trans }}</p>
{% endif %}
</div>
</div>
</div>
</div>
<!-- ▲レビューエリア -->