app/Plugin/TabaCMS2/Resource/template/default/list_gallery.twig line 1

Open in your IDE?
  1. {#
  2. Copyright (C) SPREAD WORKS Inc. All Rights Reserved.
  3. For the full copyright and license information, please view the LICENSE
  4. file that was distributed with this source code.
  5. #}
  6. {% extends 'default_frame.twig' %}
  7. {# 投稿リストの取得 #}
  8. {% set post_list = TabaCMSPostList() %}
  9. {% block javascript %}
  10. {{ TabaCMSAsset('script.js','script')|raw }}
  11. {% endblock javascript %}
  12. {% block stylesheet %}
  13. {{ TabaCMSAsset('style.css','style')|raw }}
  14. <style>
  15. .tabacms_blog_list{
  16.     display: grid;
  17.     gap: 24px;
  18.     grid-template-columns: repeat(2, 1fr);
  19. }
  20. .tabacms_blog_list li{
  21.     position: relative;
  22.     padding-bottom: 20px;
  23. }
  24. .tabacms_blog_list article,
  25. .tabacms_blog_list .tabacms_detail label{
  26.     margin: 0;
  27. }
  28. .tabacms_blog_list .tabacms_detail label{
  29.     position: absolute;
  30.     bottom: 0;
  31.     left: 0;
  32. }
  33. @media only screen and (min-width: 768px) {
  34.     .tabacms_blog_list{
  35.         grid-template-columns: repeat(3, 1fr);
  36.     }
  37. }
  38. @media only screen and (min-width: 1024px) {
  39.     .tabacms_blog_list{
  40.         grid-template-columns: repeat(5, 1fr);
  41.     }
  42. }
  43. </style>
  44. {% endblock stylesheet %}
  45. {% block main %}
  46.     <div class="ec-role">
  47.         <div class="ec-pageHeader">
  48.             <h1>{{ type.getTypeName }}</h1>
  49.         </div>
  50.         <div class="ec-pageBody">
  51.             {% if post_list.items|length > 0 %}
  52.                 <ul class="tabacms_blog_list tabacms_height_match">
  53.                     {% set no_image = TabaCMSAsset('no_image.jpg') %}
  54.                     {% for post in post_list %}
  55.                     <li>
  56.                         <article>
  57.                             <div class="tabacms_thumbnail_wrapper">
  58.                                 {% set thumb = no_image %}
  59.                                 {% if post.getThumbnail is not empty %}
  60.                                 {% set thumb = asset(post.getThumbnail,'save_image') %}
  61.                                 {% endif %}
  62.                                 <div class="tabacms_thumbnail" style="background-image:url({{ thumb }});">
  63.                                     {% if post.getContentDiv == constant('CONTENT_DIV_BODY',post) %}
  64.                                     <a href="{{ post.getURI }}"><img src="{{ thumb }}"></a>
  65.                                     {% elseif post.getContentDiv == constant('CONTENT_DIV_LINK',post) %}
  66.                                     <a href="{{ post.getLinkUrl }}" {% if post.getLinkTarget %} target="{{ post.getLinkTarget }}" {% endif %}><img src="{{ thumb }}"></a>
  67.                                     {% elseif post.getContentDiv == constant('CONTENT_DIV_TITLE',post) %}
  68.                                     <img src="{{ thumb }}">
  69.                                     {% endif %}
  70.                                 </div>
  71.                             </div>
  72.                             <div class="tabacms_detail">
  73.                                 <p class="tabacms_ellipsis_3">{{ post.getTitle }}</p>
  74.                                 {# <p class="tabacms_ellipsis_3">{{ post.getBody|striptags|raw }}</p> #}
  75.                                 {% if post.getCategory is not empty %}
  76.                                 <label class="text-nowrap tabacms_category_{{ post.getType.getDataKey }}_{{ post.getCategory.getDataKey }}" {{ post.getCategory.getTagAttributes|raw }}>{{ post.getCategory.getCategoryName }}</label>
  77.                                 {% endif %}
  78.                                 {# <time>
  79.                                     {{ post.getPublicDate|date('Y/m/d') }}
  80.                                 </time> #}
  81.                                 {# {% if post.getContentDiv == constant('CONTENT_DIV_BODY',post) %}
  82.                                 <h2 class="tabacms_ellipsis_2">
  83.                                     <a href="{{ post.getURI }}">{{ post.getTitle }}</a>
  84.                                 </h2>
  85.                                 <p class="tabacms_ellipsis_3">
  86.                                     {{ post.getBody|striptags|raw }}
  87.                                 </p>
  88.                                 <a href="{{ post.getURI }}" class="tabacms_readmore">もっと読む</a>
  89.                                 {% elseif post.getContentDiv == constant('CONTENT_DIV_LINK',post) %}
  90.                                 <h2 class="tabacms_ellipsis_2">
  91.                                     <a href="{{ post.getLinkUrl }}" {% if post.getLinkTarget %} target="{{ post.getLinkTarget }}" {% endif %}>{{ post.getTitle }}</a>
  92.                                 </h2>
  93.                                 {% elseif post.getContentDiv == constant('CONTENT_DIV_TITLE',post) %}
  94.                                 <h2 class="tabacms_ellipsis_2">
  95.                                     {{ post.getTitle }}
  96.                                 </h2>
  97.                                 {% endif %} #}
  98.                             </div>
  99.                         </article>
  100.                     </li>
  101.                     {% endfor %}
  102.                 </ul>
  103.                 {% if post_list.totalItemCount > 0 %}
  104.                     {% include "pager.twig" with {'pages':post_list.paginationData} %}
  105.                 {% endif %}
  106.             {% else %}
  107.                 <p>まだ投稿はございません</p>
  108.             {% endif %}
  109.         </div>
  110.     </div>
  111. {% endblock %}