{#
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 stylesheet %}
<style>
.ec-newsRole__newsItem {
display: block;
}
</style>
{% endblock %}
{% 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('<a id="news_readmore" class="mod-btn-01 isOpen marginTop20"><span class="btnInner">もっと見る</span></a>');
var dispNum = 5;
$(this).find('#news_readmore').click(function() {
dispNum += 5;
$(this).parent().find('.ec-newsRole__newsItem:lt(' + dispNum + ')').show();
if (dispNum >= listLength) {
$(this).hide();
}
})
}
});
});
</script>
{% endblock %}
<div class="ec-newsRole__news top-news-list">
{% for News in NewsList %}
<article class="ec-newsRole__newsItem newsBox">
<a href={{ url('news_detail', {'id': News.id}) }} class="newsBoxInner">
<div class="newsBox-header">
<span class="newsBox-header-date">{{ News.publish_date|date('Y.m.d') }}</span>
</div>
<h3 class="newsBox-hl">{{ News.title }}</h3>
</a>
</article>
{% endfor %}
</div>