app/template/default/ProductReview42/Resource/template/default/review.twig line 1

Open in your IDE?
  1. {#
  2. /*
  3.  * This file is part of the ProductReview plugin
  4.  *
  5.  * Copyright (C) 2016 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. #}
  11. {% import _self as stars %}
  12. {# 星テキスト生成用マクロ #}
  13. {% macro stars(positive, negative) %}
  14.     {% set positive_stars = ["", "★", "★★", "★★★", "★★★★", "★★★★★"] %}
  15.     {% set negative_stars = ["", "☆", "☆☆", "☆☆☆", "☆☆☆☆", "☆☆☆☆☆"] %}
  16.     {{ positive_stars[positive] }}{{ negative_stars[negative] }}
  17. {% endmacro %}
  18. <style type="text/css">
  19.     #product_review_area .review_list .recommend_name {
  20.         margin-left: 16px;
  21.     }
  22. </style>
  23. <script>
  24.     $(function() {
  25.         //$('#product_review_area').appendTo($('.ec-layoutRole__main, .ec-layoutRole__mainWithColumn, .ec-layoutRole__mainBetweenColumn'));
  26.         $('#product_review_area .ec-rectHeading').on('click', function() {
  27.             $content = $('#reviewContent');
  28.             if ($content.css('display') == 'none') {
  29.                 $(this).addClass('is_active');
  30.                 $content.addClass('is_active');
  31.                 $content.slideDown(300);
  32.             } else {
  33.                 $(this).removeClass('is_active');
  34.                 $content.removeClass('is_active');
  35.                 $content.slideUp(300);
  36.             }
  37.             return false;
  38.         });
  39.     });
  40. </script>
  41. <!--▼レビューエリア-->
  42. <div id="product_review_area">
  43.     <div class="ec-role">
  44.         {% set positive_avg_star = ProductReviewAvg %}
  45.         {% set negative_avg_star = 5 - positive_avg_star %}
  46.         <div class="ec-rectHeading">
  47.             <div class="head_title">この商品に対するお客様の声</div>
  48.             <span class="chevron pull-right">
  49.                 <span>お客様の声を見る</span>
  50.                 <div class="icon-wrap"><span class="icon"></span></div>
  51.             </span>
  52.         </div>
  53.         <div id="reviewContent">
  54.             <div class="reviewContent__inner">
  55.             <div class="reviewContent_left">
  56.                 <p class="reviewContent_left__ttl">カスタマーレビュー</p>
  57.                 <div class="recommend_wrap">
  58.                     <!--平均の星の数-->
  59.                     <span class="recommend_average">{{ stars.stars(positive_avg_star, negative_avg_star) }}</span>
  60.                     <!--レビュー数-->
  61.                     <span class="recommend_average__bottom">({{ ProductReviewCount }})件の評価</span>
  62.                 </div>
  63.                 <div class="btn_wrap">
  64.                     <a href="{{ url('product_review_index', { id: Product.id }) }}"
  65.                        class="review_write_btn">この商品のレビューを書く</a>
  66.                 </div>
  67.             </div><!--/.reviewContent_left-->
  68.             {% if ProductReviews %}
  69.                 <ul class="review_list">
  70.                     {% for ProductReview in ProductReviews %}
  71.                           <li>
  72.                             <!--タイトル-->
  73.                             <p class="review_list_ttl">{{ ProductReview.title }}</p>
  74.                             <p class="review_date">
  75.                                 <!--星の数-->
  76.                                 {% set positive_star = ProductReview.recommend_level %}
  77.                                 {% set negative_star = 5 - positive_star %}
  78.                                 <span class="recommend_level">{{ stars.stars(positive_star, negative_star) }}</span>
  79.                                 <span class="review_date__right">
  80.                                     <!--投稿日-->
  81.                                     <span class="review_date__wrap">投稿日:<span class="review_date_txt">{{ ProductReview.create_date|date_day }}</span></span>
  82.                                     <!--投稿者-->
  83.                                     <span class="recommend_name">
  84.                                      {% if ProductReview.reviewer_url %}
  85.                                          <a href="{{ ProductReview.reviewer_url }}" rel="ugc nofollow"
  86.                                             target="_blank">{{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}</a>
  87.                                      {% else %}
  88.                                          {{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}
  89.                                      {% endif %}
  90.                                     </span>
  91.                                 </span>
  92.                             </p>
  93.                             <!--レビューコメント-->
  94.                             <p>{{ ProductReview.comment|nl2br }}</p>
  95.                         </li>
  96.                     {% endfor %}
  97.                 </ul>
  98.             {% else %}
  99.                 <p>{{ 'product_review.front.product_detail.no_review'|trans }}</p>
  100.             {% endif %}
  101.         </div>
  102.         </div>
  103.     </div>
  104. </div>
  105. <!-- ▲レビューエリア -->