app/template/kaiino/ProductReview4/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 {
  20.         border-top: 1px solid #E8E8E8;
  21.         padding-bottom: 0;
  22.         margin-bottom: 20px;
  23.     }
  24.     #product_review_area .ec-rectHeading {
  25.         cursor: pointer;
  26.         margin-top: 20px;
  27.         margin-bottom: 20px;
  28.     }
  29.     #product_review_area .ec-rectHeading h3{
  30.         background: none;
  31.         font-weight: 500;
  32.     }
  33.     
  34.     #product_review_area .ec-rectHeading.is_active i {
  35.         transform: rotate(180deg);
  36.     }
  37.     #product_review_area .review_list {
  38.     }
  39.     #product_review_area .review_list li {
  40.         margin-bottom: 16px;
  41.     }
  42.     #product_review_area .review_list .title {
  43.       color: #e78d87;
  44.     }
  45.     #product_review_area .review_list .review_date {
  46.         font-weight: bold;
  47.     }
  48.     #product_review_area .recommend_average {
  49.         margin-left: 16px;
  50.         color: #DE5D50;
  51.     }
  52.     #product_review_area .review_list .recommend_level {
  53.         margin-left: 16px;
  54.         color: #DE5D50;
  55.     }
  56.     #product_review_area .review_list .recommend_name {
  57.         margin-left: 16px;
  58.     }
  59. </style>
  60. <script>
  61.     $(function() {
  62.         //$('#product_review_area').appendTo($('div.ec-layoutRole__main, div.ec-layoutRole__mainWithColumn, div.ec-layoutRole__mainBetweenColumn'));
  63.         $('#product_review_area').prependTo($('#related_product_area'));
  64.         $('#product_review_area .ec-rectHeading').on('click', function() {
  65.             $content = $('#reviewContent');
  66.             if ($content.css('display') == 'none') {
  67.                 $(this).addClass('is_active');
  68.                 $content.addClass('is_active');
  69.                 $content.slideDown(300);
  70.             } else {
  71.                 $(this).removeClass('is_active');
  72.                 $content.removeClass('is_active');
  73.                 $content.slideUp(300);
  74.             }
  75.             return false;
  76.         });
  77.     });
  78. </script>
  79. <!--▼レビューエリア-->
  80. <div id="product_review_area">
  81.     <div class="ec-role">
  82.         {% set positive_avg_star = ProductReviewAvg %}
  83.         {% set negative_avg_star = 5 - positive_avg_star %}
  84.         <div class="ec-pageHeader">
  85.           <div class="ec-rectHeading is_active">
  86.           <h3>{{ 'product_review.front.product_detail.title'|trans }}
  87.                 <!--平均の星の数-->
  88.                 <span class="recommend_average">{{ stars.stars(positive_avg_star, negative_avg_star) }}</span>
  89.                 <!--レビュー数-->
  90.                 <span>({{ ProductReviewCount }})</span>
  91.                 <span class="chevron pull-right">
  92.                     <i class="fas fa-angle-up fa-lg"></i>
  93.                 </span></h3>
  94.           </div>
  95.         </div>
  96.         <div id="reviewContent">
  97.             {% if ProductReviews %}
  98.                 <ul class="review_list">
  99.                     {% for ProductReview in ProductReviews %}
  100.                         <li>
  101.                           
  102.                           <!--タイトル-->
  103.                           <div class="title">{{ ProductReview.title }}</div>
  104.                             <p class="review_date">
  105.                                 <!--投稿日-->
  106.                                 {{ ProductReview.create_date|date_day }}
  107.                                 <!--投稿者-->
  108.                                 <span class="recommend_name">
  109.                                             {% if ProductReview.reviewer_url %}
  110.                                                 <a href="{{ ProductReview.reviewer_url }}"
  111.                                                    target="_blank">{{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}</a>
  112.                                             {% else %}
  113.                                                 {{ 'product_review.front.product_detail.name'|trans({ '%name%': ProductReview.reviewer_name }) }}
  114.                                             {% endif %}
  115.                                         </span>
  116.                                 <!--星の数-->
  117.                                 {% set positive_star = ProductReview.recommend_level %}
  118.                                 {% set negative_star = 5 - positive_star %}
  119.                                 <span class="recommend_level">
  120.                                     {{ stars.stars(positive_star, negative_star) }}
  121.                                 </span>
  122.                             </p>
  123.                             <!--レビューコメント-->
  124.                             <p>{{ ProductReview.comment|nl2br }}</p>
  125.                         </li>
  126.                     {% endfor %}
  127.                 </ul>
  128.             {% else %}
  129.                 <p>{{ 'product_review.front.product_detail.no_review'|trans }}</p>
  130.             {% endif %}
  131.         </div>
  132.         <div class="read_more">
  133.             <a href="{{ url('product_review_index', { id: Product.id }) }}"
  134.                class="">{{ 'product_review.front.product_detail.post_review'|trans }}</a>
  135.         </div>
  136.     </div>
  137. </div>
  138. <!-- ▲レビューエリア -->