{#
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() {
$('.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="ec-inlineBtn--top">{{ 'more'|trans }}</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();
}
})
}
});
// $('.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 %}
<div class="ec-role">
<div class="ec-newsRole topNewsSpliter">
<div class="ec-newsRole__listTitle">
<div class="ec-newsRole__listItemHeading ec-secHeading--tandem">
<span class="ec-secHeading__en">{{ 'NEWS'|trans }}</span>
<span class="ec-secHeading__ja">{{ 'ニュース'|trans }}</span>
</div>
<a class="ec-recommendedBtn--more show-resultPC" href="{{ url('news_list') }}">{{ 'ニュース一覧を見る'|trans }}</a>
</div>
<div class="ec-newsRole__news">
{% for key, News in NewsList %}
{% if key < 4 %}
<div class="ec-newsRole__newsItem">
<a class="ec-newsItem" href="{{ url('news_detail', {'id': News.id}) }}">
<div class="ec-newsRole__newsHeading">
<div class="ec-newsRole__newsDate">
{{ News.publish_date|date_day }}
</div>
<div class="ec-newsRole__newsTitle">
{{ News.title }}
</div>
{% if key % 2 == 1 %}
<span class="ec-newsRole__newsBtn even">{{ 'お知らせ'|trans }}</span>
{% else %}
<span class="ec-newsRole__newsBtn odd">{{ 'お知らせ'|trans }}</span>
{% endif %}
</div>
</a>
</div>
{% endif %}
{% endfor %}
</div>
<div class="ec-newsRole__listTitle newsRole__listTitleBottom">
<a class="ec-recommendedBtn--more show-resultSP" href="{{ url('news_list') }}">{{ 'ニュース一覧を見る'|trans }}</a>
</div>
</div>
</div>