app/template/blueshop/Block/news.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% set NewsList = repository('Eccube\\Entity\\News').getList() %}
  9. {% block javascript %}
  10.     <script>
  11.         $(function() {
  12.             $('.ec-newsRole__news').each(function() {
  13.                 var listLength = $(this).find('.ec-newsRole__newsItem').length;
  14.                 if (listLength > 3) {
  15.                     $(this).find('.ec-newsRole__newsItem:gt(2)').each(function() {
  16.                         $(this).hide();
  17.                     });
  18.                     $(this).append('<a id="news_readmore" class="ec-inlineBtn--top">{{ 'もっと見る'|trans }}</a>');
  19.                     var dispNum = 3;
  20.                     $(this).find('#news_readmore').click(function() {
  21.                         dispNum += 3;
  22.                         $(this).parent().find('.ec-newsRole__newsItem:lt(' + dispNum + ')').show();
  23.                         if (dispNum >= listLength) {
  24.                             $(this).hide();
  25.                         }
  26.                     })
  27.                 }
  28.             });
  29.         });
  30.     </script>
  31. {% endblock %}
  32. <div class="ec-role news main-ele" id="news">
  33.     <div class="ec-newsRole container">
  34.         {# <div class="ec-secHeading">
  35.             <span class="ec-secHeading__en">{{ 'NEWS'|trans }}</span>
  36.             <span class="ec-secHeading__line"></span>
  37.             <span class="ec-secHeading__ja">{{ '新着情報'|trans }}</span>
  38.         </div> #}
  39.         <div class="section-title">
  40.             <h2 class="en wow fadeInUp" data-wow-duration="1s" data-wow-delay="0.3s" style="visibility: visible; animation-duration: 1s; animation-delay: 0.3s; animation-name: fadeInUp;">News</h2>
  41.             <p class="wow fadeInUp" data-wow-duration="1s" data-wow-delay="0.3s" style="visibility: visible; animation-duration: 1s; animation-delay: 0.3s; animation-name: fadeInUp;">新着情報</p>
  42.         </div>
  43.         <div class="ec-newsRole__news section-content">
  44.             {% for News in NewsList %}
  45.             <a href={{ url('news_detail',  {'id': News.id}) }} class="ec-newsRole__newsItem" target="_blank">
  46.                 <div class="content-ele">
  47.                     <div class="ec-newsRole__newsHeading">
  48.                         <div class="ec-newsRole__newsDate">
  49.                             {{ News.publish_date|date_day }}
  50.                         </div>
  51.                         <div class="ec-newsRole__newsTitle">
  52.                             {{ News.title }}
  53.                         </div>
  54.                         {# {% if News.description or News.url %}
  55.                             <div class="ec-newsRole__newsClose">
  56.                                 <a class="ec-newsRole__newsCloseBtn">
  57.                                     <i class="fas fa-angle-down"></i>
  58.                                 </a>
  59.                             </div>
  60.                         {% endif %} #}
  61.                     </div>
  62.                     {# <div class="ec-newsRole__newsDescription">
  63.                         {{ News.description|raw|nl2br }}
  64.                         {% if News.url %}
  65.                             <br>
  66.                             <a href="{{ News.url }}" {% if News.link_method == '1' %}target="_blank"{% endif %}>{{ '詳しくはこちら'|trans }}</a>
  67.                         {% endif %}
  68.                     </div> #}
  69.                 </div>
  70.             </a>
  71.             {% endfor %}
  72.         </div>
  73.     </div>
  74. </div>