{#
Copyright (C) SPREAD WORKS Inc. All Rights Reserved.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends 'default_frame.twig' %}
{# 投稿リストの取得 #}
{% set post_list = TabaCMSPostList() %}
{% block javascript %}
{{ TabaCMSAsset('script.js','script')|raw }}
{% endblock javascript %}
{% block stylesheet %}
{{ TabaCMSAsset('style.css','style')|raw }}
<style>
.tabacms_blog_list{
display: grid;
gap: 24px;
grid-template-columns: repeat(2, 1fr);
}
.tabacms_blog_list li{
position: relative;
padding-bottom: 20px;
}
.tabacms_blog_list article,
.tabacms_blog_list .tabacms_detail label{
margin: 0;
}
.tabacms_blog_list .tabacms_detail label{
position: absolute;
bottom: 0;
left: 0;
}
@media only screen and (min-width: 768px) {
.tabacms_blog_list{
grid-template-columns: repeat(3, 1fr);
}
}
@media only screen and (min-width: 1024px) {
.tabacms_blog_list{
grid-template-columns: repeat(5, 1fr);
}
}
</style>
{% endblock stylesheet %}
{% block main %}
<div class="ec-role">
<div class="ec-pageHeader">
<h1>{{ type.getTypeName }}</h1>
</div>
<div class="ec-pageBody">
{% if post_list.items|length > 0 %}
<ul class="tabacms_blog_list tabacms_height_match">
{% set no_image = TabaCMSAsset('no_image.jpg') %}
{% for post in post_list %}
<li>
<article>
<div class="tabacms_thumbnail_wrapper">
{% set thumb = no_image %}
{% if post.getThumbnail is not empty %}
{% set thumb = asset(post.getThumbnail,'save_image') %}
{% endif %}
<div class="tabacms_thumbnail" style="background-image:url({{ thumb }});">
{% if post.getContentDiv == constant('CONTENT_DIV_BODY',post) %}
<a href="{{ post.getURI }}"><img src="{{ thumb }}"></a>
{% elseif post.getContentDiv == constant('CONTENT_DIV_LINK',post) %}
<a href="{{ post.getLinkUrl }}" {% if post.getLinkTarget %} target="{{ post.getLinkTarget }}" {% endif %}><img src="{{ thumb }}"></a>
{% elseif post.getContentDiv == constant('CONTENT_DIV_TITLE',post) %}
<img src="{{ thumb }}">
{% endif %}
</div>
</div>
<div class="tabacms_detail">
<p class="tabacms_ellipsis_3">{{ post.getTitle }}</p>
{# <p class="tabacms_ellipsis_3">{{ post.getBody|striptags|raw }}</p> #}
{% if post.getCategory is not empty %}
<label class="text-nowrap tabacms_category_{{ post.getType.getDataKey }}_{{ post.getCategory.getDataKey }}" {{ post.getCategory.getTagAttributes|raw }}>{{ post.getCategory.getCategoryName }}</label>
{% endif %}
{# <time>
{{ post.getPublicDate|date('Y/m/d') }}
</time> #}
{# {% if post.getContentDiv == constant('CONTENT_DIV_BODY',post) %}
<h2 class="tabacms_ellipsis_2">
<a href="{{ post.getURI }}">{{ post.getTitle }}</a>
</h2>
<p class="tabacms_ellipsis_3">
{{ post.getBody|striptags|raw }}
</p>
<a href="{{ post.getURI }}" class="tabacms_readmore">もっと読む</a>
{% elseif post.getContentDiv == constant('CONTENT_DIV_LINK',post) %}
<h2 class="tabacms_ellipsis_2">
<a href="{{ post.getLinkUrl }}" {% if post.getLinkTarget %} target="{{ post.getLinkTarget }}" {% endif %}>{{ post.getTitle }}</a>
</h2>
{% elseif post.getContentDiv == constant('CONTENT_DIV_TITLE',post) %}
<h2 class="tabacms_ellipsis_2">
{{ post.getTitle }}
</h2>
{% endif %} #}
</div>
</article>
</li>
{% endfor %}
</ul>
{% if post_list.totalItemCount > 0 %}
{% include "pager.twig" with {'pages':post_list.paginationData} %}
{% endif %}
{% else %}
<p>まだ投稿はございません</p>
{% endif %}
</div>
</div>
{% endblock %}