{% set NewsList = repository('Eccube\\Entity\\News').getList() %}{% block javascript %} <script> $(function() { $('.ec-newsRole__news').each(function() { var listLength = $(this).find('.ec-newsRole__newsItem').length; if (listLength > 5) { $(this).find('.ec-newsRole__newsItem:gt(4)').each(function() { $(this).hide(); }); $(this).append('<div style="text-align: center;"><a id="news_readmore" class="news_readmore"><img src="{{ asset('assets/img/top_page/link_show_more_news.png', 'user_data') }}"></a></div>'); var dispNum = 5; $(this).find('#news_readmore').click(function() { dispNum += 5; $(this).parent().parent().find('.ec-newsRole__newsItem:lt(' + dispNum + ')').show(); if (dispNum >= listLength) { $(this).hide(); } }) } }); $('.ec-newsRole__newsHeading').on('click', function() { $newsItem = $(this).parent('.ec-newsRole__newsItem'); $newsDescription = $newsItem.children('.ec-newsRole__newsDescription'); if ($newsDescription.css('display') == 'none') { $newsItem.addClass('is_active'); $newsDescription.slideDown(300); } else { $newsItem.removeClass('is_active'); $newsDescription.slideUp(300); } return false; }); }); </script>{% endblock %}{% block stylesheet %} <style> .ec-newsRole .ec-newsRole__newsDate { color: #525263; font-size: 12px; font-style: normal; font-weight: 600; line-height: 16px; } .ec-newsRole .ec-newsRole__newsTitle { color: #000; font-size: 14px; font-style: normal; font-weight: 700; line-height: 20px; } .ec-newsRole .ec-newsRole__newsDescription { color: #000; font-size: 14px; font-style: normal; font-weight: 600; line-height: 20px; } .fas { font-size: 23px; } .ec-newsRole__newsDescription .detail_link { display: block; margin-top: 8px; color: #337AB7; font-size: 14px; font-style: normal; font-weight: 600; line-height: 20px; } .ec-newsRole .ec-newsRole__newsCloseBtn { display: block; margin-left: auto; border-radius: 100%; width: 20px; height: 24px; color: black; text-align: center; background: none; cursor: pointer; position: absolute; right: 5px; } .news_readmore img { max-width: 88px; margin-top: 26px; margin-bottom: 10px; } </style>{% endblock %}<div class="ec-role" style="padding-left: 16px; padding-right: 16px; margin-bottom: 104px;"> <div class="ec-newsRole" style="padding: 0px;"> <div class="block_content" style="margin-bottom: 32px;"> <img src="{{ asset('assets/img/top_page/text_4.png', 'user_data') }}" alt="NEWS|お知らせ" style="width: 100%; width: 450px;"> </div> <div class="ec-newsRole__news" style="border: none; padding: 0px;"> {% for News in NewsList %} <div class="ec-newsRole__newsItem"> <div class="ec-newsRole__newsHeading"> <div class="ec-newsRole__newsDate"> {{ News.publish_date|date_day }} </div> <div class="ec-newsRole__newsColumn"> <div class="ec-newsRole__newsTitle"> {{ News.title }} </div> {% if News.description or News.url %} <div class="ec-newsRole__newsClose"> <a class="ec-newsRole__newsCloseBtn"> <i class="fas fa-angle-down"></i> </a> </div> {% endif %} </div> </div> <div class="ec-newsRole__newsDescription"> {{ News.description|raw|nl2br }} {% if News.url %} <br> <a class="detail_link" href="{{ News.url }}" {% if News.link_method == '1' %}target="_blank"{% endif %}>{{ '詳しくはこちら'|trans }}</a> {% endif %} </div> </div> {% endfor %} </div> </div></div>