app/template/bynoiezam/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.                 $(this).parent().find('.ec-newsRole__newsItem').show();
  14.             });
  15.             $('.ec-newsRole__newsHeading').on('click', function() {
  16.                 $newsItem = $(this).parent('.ec-newsRole__newsItem');
  17.                 $newsDescription = $newsItem.children('.ec-newsRole__newsDescription');
  18.                 if ($newsDescription.css('display') == 'none') {
  19.                     $newsItem.addClass('is_active');
  20.                     $(this).find('img').attr('src','{{ asset("assets/icon/side-arrow-right-gray2.svg") }}');
  21.                     $newsDescription.slideDown(300);
  22.                     $(this).find('img').css({
  23.                       'transform':'rotate(90deg)'
  24.                     });
  25.                 } else {
  26.                     $(this).find('img').attr('src','{{ asset("assets/icon/side-arrow-right-gray2.svg") }}');
  27.                     $(this).find('img').css({
  28.                       'transform':'rotate(0deg)'
  29.                     });
  30.                     $newsItem.removeClass('is_active');
  31.                     $newsDescription.slideUp(300);
  32.                 }
  33.                 return false;
  34.             });
  35.         });
  36.     </script>
  37. {% endblock %}
  38. {% if NewsList|length > 0 %}
  39. <div class="ec-role">
  40.     <div class="ec-newsRole ec-contentRole">
  41.         <div class="ec-secHeading">
  42.             <div>
  43.                 <span class="ec-secHeading__en">{{ 'NEWS'|trans }}</span>
  44.                 <img src="{{ asset('assets/icon/slash.svg') }}" alt="" class="ec-slash is-pc">
  45.                 <span class="ec-secHeading__ja">{{ '新着情報'|trans }}</span>
  46.             </div>
  47.         </div>
  48.         <div class="ec-newsRole__news">
  49.             {% for News in NewsList %}
  50.                 <div class="ec-newsRole__newsItem">
  51.                     <div class="ec-newsRole__newsHeading{% if News.description or News.url %} has-description{% endif %}">
  52.                         <div class="ec-newsRole__newsDate">
  53.                             {{ News.publish_date|date_day }}
  54.                         </div>
  55.                         <div class="ec-newsRole__newsColumn">
  56.                             <div class="ec-newsRole__newsTitle">
  57.                                 {{ News.title|raw }}
  58.                             </div>
  59.                             {% if News.description or News.url %}
  60.                                 <div class="ec-newsRole__newsClose">
  61.                                     <a class="ec-newsRole__newsCloseBtn">
  62.                                         <img src="{{ asset("assets/icon/side-arrow-right-gray2.svg") }}" alt="">
  63.                                     </a>
  64.                                 </div>
  65.                             {% endif %}
  66.                         </div>
  67.                     </div>
  68.                     {% if News.description or News.url %}
  69.                         <div class="ec-newsRole__newsDescription">
  70.                             {{ News.description|raw|nl2br }}
  71.                             {% if News.url %}
  72.                                 <br>
  73.                                 <a href="{{ News.url }}" {% if News.link_method == '1' %}target="_blank"{% endif %}>{{ '詳しくはこちら'|trans }}</a>
  74.                             {% endif %}
  75.                         </div>
  76.                     {% endif %}
  77.                 </div>
  78.             {% endfor %}
  79.         </div>
  80.     </div>
  81. </div>
  82. {% endif %}