app/template/default/Block/t_customer.twig line 1

Open in your IDE?
  1. {% set NewsList = repository('Eccube\\Entity\\News').getList() %}
  2. {% block javascript %}
  3.     <script>
  4.          $(function() {
  5.             $('.p-top__news__box').each(function() {
  6.                 var listLength = $(this).find('.ec-newsRole__newsItem').length;
  7.                 if (listLength > 5) {
  8.                     $(this).find('.ec-newsRole__newsItem:gt(4)').each(function() {
  9.                         $(this).hide();
  10.                     });
  11.                     $(this).append('<a id="news_readmore" class="ec-inlineBtn--top">{{ 'もっと見る'|trans }}</a>');
  12.                     var dispNum = 5;
  13.                     $(this).find('#news_readmore').click(function() {
  14.                         dispNum += 5;
  15.                         $(this).parent().find('.ec-newsRole__newsItem:lt(' + dispNum + ')').show();
  16.                         if (dispNum >= listLength) {
  17.                             $(this).hide();
  18.                         }
  19.                     })
  20.                 }
  21.             });
  22.             $('.ec-newsRole__newsHeading').on('click', function() {
  23.                 $newsItem = $(this).parent('.ec-newsRole__newsItem');
  24.                 $newsDescription = $newsItem.children('.ec-newsRole__newsDescription');
  25.                 if ($newsDescription.css('display') == 'none') {
  26.                     $newsItem.addClass('is_active');
  27.                     $newsDescription.slideDown(300);
  28.                 } else {
  29.                     $newsItem.removeClass('is_active');
  30.                     $newsDescription.slideUp(300);
  31.                 }
  32.                 return false;
  33.             });
  34.         });
  35.     </script>
  36. {% endblock %}
  37. <!-- start customer -->
  38.         {#<section class="p-top__customer">#}
  39.         {#    <img class="absolute1" src="{{asset ('/test-ec-04/html/user_data/assets/img/common/cloud__gl2.webp')}}" alt="雲">#}
  40.         {#    <img class="absolute2" src="{{asset ('/test-ec-04/html/user_data/assets/img/common/cloud_gl1.webp')}}" alt="雲">#}
  41.         {#    <img class="absolute3" src="{{asset ('/test-ec-04/html/user_data/assets/img/common/meetbox.webp')}}" alt="お肉BOX">#}
  42.         {#    <div class="section__title">#}
  43.         {#        <img src="{{asset ('/test-ec-04/html/user_data/assets/img/common/cow.webp')}}" alt="牛のイラスト">#}
  44.         {#        <h2>お客様の声</h2>#}
  45.         {#    </div>#}
  46.         {#    <div class="p-top__customer__box">#}
  47.         {#        <div class="p-top__customer__box__item">#}
  48.         {#            <img src="{{asset ('/test-ec-05/html/user_data/assets/img/common/hamburg.webp')}}" alt="ハンバーグ">#}
  49.         {#           <h3 class="p-top__customer__box__item__title">定期的に食べたくなるハンバーグ</h3>#}
  50.         {#           <p class="p-top__customer__box__item__text">焼き肉が一番だけど定期的に食べたくなるのがハンバーグ!珍しいタイプの懐かしさを感じる煮込みハンバーグは舌でほぐせるくらいほろほろのお肉。上質なお肉を使ってるから出来る味は家庭では再現できない満足感があります。</p>#}
  51.         {#           <p class="p-top__customer__box__item__prof">20代 | 女性 |<img src="{{asset ('/test-ec-04/html/user_data/assets/img/common/star.webp')}}" alt=""></p>#}
  52.         {#        </div>#}
  53.         {#        <div class="p-top__customer__box__item">#}
  54.         {#            <img src="{{asset ('/test-ec-05/html/user_data/assets/img/common/bbq.webp')}}" alt="BBQ">#}
  55.         {#           <h3 class="p-top__customer__box__item__title">友人とバーベキュー!!</h3>#}
  56.         {#           <p class="p-top__customer__box__item__text">夏なのでバーベキューということで、モーサイドさんからBBQセットを注文して友人と食べました!<br><br>#}
  57.         {#            安いのにとても美味しかったです!!<br>また注文します!<br>#}
  58.         {#        </p>#}
  59.         {#           <p class="p-top__customer__box__item__prof">20代 | 男性 |<img src="{{asset ('/test-ec-04/html/user_data/assets/img/common/star.webp')}}" alt=""></p>#}
  60.         {#        </div>#}
  61.         {#        <div class="p-top__customer__box__item">#}
  62.         {#            <img src="{{asset ('/test-ec-05/html/user_data/assets/img/common/family.webp')}}" alt="焼肉">#}
  63.         {#           <h3 class="p-top__customer__box__item__title">家族と自分へのご褒美に!</h3>#}
  64.         {#           <p class="p-top__customer__box__item__text">#}
  65.         {#            家族と自分へのご褒美に少しプチ贅沢!<br>#}
  66.         {#            お肉も柔らかくて美味しいのに安い。<br><br>#}
  67.         {#            リピート確定です。<br>#}
  68.         {#            また注文します!!<br><br>#}
  69.         {#           </p>#}
  70.         {#           <p class="p-top__customer__box__item__prof">30代 | 女性 |<img src="{{asset ('/test-ec-04/html/user_data/assets/img/common/star.webp')}}" alt=""></p>#}
  71.         {#        </div>#}
  72.         {#    </div>#}
  73.         {#    <a href="#" class="more__page">もっと見る</a>#}
  74.         {#</section>#}
  75.         <!-- end customer -->
  76.         <!-- start top_news -->
  77.         <section class="p-top__news">
  78.             <div class="section__title">
  79.                 <div class="image-wrapper">
  80.                     <img src="{{asset ('/test-ec-05/html/user_data/assets/img/common/Cow3.png')}}" alt="牛さん">
  81.                 </div>
  82.                 <h2>お知らせ</h2>
  83.             </div>
  84.             <div class="ec-newsRole__news">
  85.                 <div class="p-top__news__box">
  86.                     {% for News in NewsList %}
  87.                     <div class="ec-newsRole__newsItem p-top__news__box__item">
  88.                         <div class="ec-newsRole__newsHeading">
  89.                             <div class="ec-newsRole__newsDate p-top__news__box__item__date">
  90.                                 {{ News.publish_date|date_day }}
  91.                             </div>
  92.                             <span>お知らせ</span>
  93.                             <div class="ec-newsRole__newsColumn">
  94.                                 <div class="ec-newsRole__newsTitle">
  95.                                     {{ News.title }}
  96.                                 </div>
  97.                                 {% if News.description or News.url %}
  98.                                     <div class="ec-newsRole__newsClose">
  99.                                         <a class="ec-newsRole__newsCloseBtn">
  100.                                             <i class="fas fa-angle-down"></i>
  101.                                         </a>
  102.                                     </div>
  103.                                 {% endif %}
  104.                             </div>
  105.                         </div>
  106.                         <div class="ec-newsRole__newsDescription ">
  107.                             {{ News.description|raw|nl2br }}
  108.                             {% if News.url %}
  109.                                 <br>
  110.                                 <a href="{{ News.url }}" {% if News.link_method == '1' %}target="_blank"{% endif %}>{{ '詳しくはこちら'|trans }}</a>
  111.                             {% endif %}
  112.                         </div>
  113.                     </div>
  114.                 {% endfor %}
  115.                 </div>
  116.             </div>
  117.         </section>
  118.         <!-- end top__news -->
  119.     
  120. {% block sytlesheet %}
  121. <style>
  122.     .p-top__news__box__item__date {
  123.         display: inline-block;
  124.     }
  125.     .ec-newsRole__newsColumn {
  126.         display: flex;
  127.         justify-content: space-between;
  128.     }
  129.     #news_readmore {
  130.         padding: 10px 24px;
  131.         margin-top: 15px;
  132.     }
  133. </style>
  134. {% endblock %}