{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% set NewsList = repository('Eccube\\Entity\\News').getList() %}
{% block javascript %}
<script>
$(function () {
$('.news__list').each(function () {
var listLength = $(this).find('.news__item').length;
if (listLength > 5) {
$(this).find('.news__item:gt(4)').each(function () {
$(this).hide();
});
$(this).append('<a id="news_readmore" class="ec-inlineBtn--top">{{ 'more'|trans }}</a>');
var dispNum = 5;
$(this).find('#news_readmore').click(function () {
dispNum += 5;
$(this).parent().find('.news__item:lt(' + dispNum + ')').show();
if (dispNum >= listLength) {
$(this).hide();
}
})
}
});
$('.news__item-heading').on('click', function () {
$newsItem = $(this).parent('.news__item');
$newsDescription = $newsItem.children('.news__item-desc');
if ($newsDescription.css('display') == 'none') {
$newsItem.addClass('is-active');
$newsDescription.slideDown(300);
} else {
$newsItem.removeClass('is-active');
$newsDescription.slideUp(300);
}
return false;
});
});
</script>
{% endblock %}
<section class="news">
<div class="inner">
<h2 class="section__heading">News<span class="section__sub-heading">お知らせ</span></h2>
<ul class="news__list">
{% for News in NewsList %}
<li class="news__item">
<div class="news__item-heading">
<p class="news__item-date">
{{ News.publish_date|date_day }}
</p>
<div class="news__item-column">
<div class="news__item-title">
{{ News.title }}
</div>
{% if News.description or News.url %}
<div class="news__item-close"></div>
{% endif %}
</div>
</div>
<p class="news__item-desc">
{{ News.description|raw|nl2br }}
{% if News.url %}
<br>
<a href="{{ News.url }}" {% if News.link_method=='1' %}target="_blank" {% endif %}>{{ '詳しくはこちら'|trans }}</a>
{% endif %}
</p>
</li>
{% endfor %}
</ul>
</div>
</section>