app/template/plants/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 stylesheet %}
  10.     <style>
  11.         .ec-newsRole .ec-newsRole__news {
  12.             border: none;
  13.             padding: 0;
  14.         }
  15.         .ec-newsRole .ec-newsRole__newsItem:not(:last-of-type) {
  16.             border-bottom: none;
  17.         }
  18.     </style>
  19. {% endblock %}
  20. {% block javascript %}
  21.     <script>
  22.         $(function() {
  23.             $('.ec-newsRole__news').each(function() {
  24.                 var listLength = $(this).find('.ec-newsRole__newsItem').length;
  25.                 if (listLength > 6) {
  26.                     $(this).find('.ec-newsRole__newsItem:gt(5)').each(function() {
  27.                         $(this).hide();
  28.                     });
  29.         {#                    $(this).append('<a id="news_readmore" class="ec-inlineBtn--top">{{ 'more'|trans }}</a>');
  30.                     var dispNum = ;
  31.                     $(this).find('#news_readmore').click(function() {
  32.                         dispNum += 6;
  33.                         $(this).parent().find('.ec-newsRole__newsItem:lt(' + dispNum + ')').show();
  34.                         if (dispNum >= listLength) {
  35.                             $(this).hide();
  36.                         }
  37.                     })#}
  38.                 }
  39.             });
  40.             $('.ec-newsRole__newsHeading').on('click', function() {
  41.                 $newsItem = $(this).parent('.ec-newsRole__newsItem');
  42.                 $newsDescription = $newsItem.children('.ec-newsRole__newsDescription');
  43.                 if ($newsDescription.css('display') == 'none') {
  44.                     $newsItem.addClass('is_active');
  45.                     $newsDescription.slideDown(300);
  46.                 } else {
  47.                     $newsItem.removeClass('is_active');
  48.                     $newsDescription.slideUp(300);
  49.                 }
  50.                 return false;
  51.             });
  52.         });
  53.     </script>
  54. {% endblock %}
  55. <div class="ec-role">
  56.     <div class="ec-newsRole">
  57.         {#<div class="ec-secHeading">#}
  58.         {#    <span class="ec-secHeading__en">{{ 'NEWS'|trans }}</span>#}
  59.         {#    <span class="ec-secHeading__line"></span>#}
  60.         {#    <span class="ec-secHeading__ja">{{ '新着情報'|trans }}</span>#}
  61.         {#</div>#}
  62.         
  63.         <div class="ec-newsRole__news">
  64.             {% for News in NewsList %}
  65.                 <div class="ec-newsRole__newsItem"  data-aos="fade-up">
  66.                     <div class="ec-newsRole__newsHeading">
  67.                         <div class="ec-newsRole__newsDate news_date">
  68.                             {{ News.publish_date|date_day }}
  69.                         </div>
  70.                         <div class="ec-newsRole__newsColumn news_ttl">
  71.                             <div class="ec-newsRole__newsTitle">
  72.                                 {{ News.title }}
  73.                             </div>
  74.                             {#{% if News.description or News.url %}#}
  75.                             {#    <div class="ec-newsRole__newsClose">#}
  76.                             {#        <a class="ec-newsRole__newsCloseBtn">#}
  77.                             {#            <i class="fas fa-angle-down"></i>#}
  78.                             {#        </a>#}
  79.                             {#    </div>#}
  80.                             {#{% endif %}#}
  81.                         </div>
  82.                     </div>
  83.         {#    <div class="ec-newsRole__newsDescription">
  84.                         {{ News.description|raw|nl2br }}
  85.                         {% if News.url %}
  86.                             <br>
  87.                             <a href="{{ News.url }}" {% if News.link_method == '1' %}target="_blank"{% endif %}>{{ '詳しくはこちら'|trans }}</a>
  88.                         {% endif %}
  89.                     </div>#}
  90.                 </div>
  91.             {% endfor %}
  92.         </div>
  93.  
  94.         
  95.     </div>
  96. </div>