app/template/default/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.             $('.block-news .ec-newsRole__newsHeading').on('click', function() {
  13.                 $newsItem = $(this).parent('.ec-newsRole__newsItem');
  14.                 $newsDescription = $newsItem.children('.ec-newsRole__newsDescription');
  15.                 if ($newsDescription.css('display') == 'none') {
  16.                     $newsItem.addClass('is_active');
  17.                     $newsDescription.slideDown(300);
  18.                 } else {
  19.                     $newsItem.removeClass('is_active');
  20.                     $newsDescription.slideUp(300);
  21.                 }
  22.                 return false;
  23.             })
  24.         });
  25.     </script>
  26. {% endblock %}
  27. <div class="ec-role block-news">
  28.     <div class="ec-newsRole">
  29.         <div class="ec-secHeading">
  30.             <span class="ec-secHeading__en">{{ 'NEWS'|trans }}</span>
  31.             <span class="ec-secHeading__line"></span>
  32.             <span class="ec-secHeading__ja">{{ '新着情報'|trans }}</span>
  33.         </div>
  34.         <div class="ec-newsRole__news">
  35.             {% for News in NewsList %}
  36.                 <div class="ec-newsRole__newsItem">
  37.                     <div class="ec-newsRole__newsHeading">
  38.                         <div class="ec-newsRole__newsDate">
  39.                             {{ News.publish_date|date_day }}
  40.                         </div>
  41.                         <div class="ec-newsRole__newsColumn">
  42.                             <div class="ec-newsRole__newsTitle">
  43.                                 {{ News.title }}
  44.                             </div>
  45.                             {% if News.description or News.url %}
  46.                                 <div class="ec-newsRole__newsClose">
  47.                                     <a class="ec-newsRole__newsCloseBtn">
  48.                                         <i class="fas fa-angle-down"></i>
  49.                                     </a>
  50.                                 </div>
  51.                             {% endif %}
  52.                         </div>
  53.                     </div>
  54.                     <div class="ec-newsRole__newsDescription">
  55.                         {{ News.description|raw|nl2br }}
  56.                         {% if News.url %}
  57.                             <br>
  58.                             <a href="{{ News.url }}" {% if News.link_method == '1' %}target="_blank"{% endif %}>{{ '詳しくはこちら'|trans }}</a>
  59.                         {% endif %}
  60.                     </div>
  61.                 </div>
  62.             {% endfor %}
  63.         </div>
  64.     </div>
  65. </div>