app/template/default/blog/list.twig line 1

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% block javascript %}{% endblock %}
  3. {% block stylesheet %}
  4. <style>
  5. /* .pluginCMBblog .item_blog_image {
  6.     width: 100% !important;
  7.     height: 248px;
  8.     object-fit: cover;
  9. }
  10. .pluginCMBblog .figure__main_image{
  11.     margin: 0;
  12.     padding: 0;
  13.     display: grid;
  14.     justify-content: stretch;
  15.     align-items: flex-end;
  16. }
  17. .pluginCMBblog .item_blog_image,
  18. .pluginCMBblog figcaption {
  19.     padding: 0;
  20.     grid-column: 1/2;
  21.     grid-row: 1/2;
  22. }
  23. .pluginCMBblog figcaption {
  24.     text-align: center;
  25.     padding: 0.4rem 2rem;
  26.     font-size: 1rem;
  27.     background-color: rgba(0,0,0,.7);
  28.     color: #fff;
  29.     overflow: hidden;
  30.     white-space: normal;
  31.     word-wrap: break-word;
  32. } */
  33. .pluginCMBblog .ec-topicpath .ec-topicpath__item{
  34.     display: initial !important;
  35. }
  36. .pluginCMBblog .list_blog_cat li {
  37.     display: initial !important;
  38.     letter-spacing: 0.2rem;
  39.     font-size: 16px;
  40. }
  41. .pluginCMBblog .list_blog .list_category_link{
  42.     color: #337ab7;
  43.     padding: .2rem 0.5rem;
  44.     font-size: 1.3rem;
  45.     
  46.     border-right: 1px solid #ddd;
  47. }
  48. .pluginCMBblog .blog_category li:last-child .list_category_link{
  49.     border: none;
  50. }
  51. .w-100 {
  52.     width: 100%
  53. }
  54. .side-bar > div {
  55.     width: 90%;
  56. }
  57. h5.tag-header {
  58.     font-family: Oswald;
  59.     font-weight: bold;
  60.     font-size: 22px;
  61.     color: #333;
  62.     border-bottom: 4px solid #000;
  63. }
  64. .month-archive a {
  65.     margin-bottom: 8px;
  66.     display: block;
  67.     color: #333;
  68. }
  69. .month-archive a:hover {
  70.     color: #337ab7;
  71. }
  72. .archive-link-div {
  73.     max-height: 600px;
  74.     overflow-y: scroll;
  75. }
  76. .archive-link-div::-webkit-scrollbar {
  77.     display: none;
  78. }
  79. .pluginCMBblog .blog-list {
  80.     padding-left: 0;
  81.     list-style-type: none;
  82. }
  83. .pluginCMBblog .blog-list__item {
  84.     margin: 20px 0;
  85.     display: flex;
  86.     align-items: center;
  87.     gap: 15px;
  88. }
  89. .pluginCMBblog .blog-list__item .blog-image {
  90.     max-width: 170px;
  91. }
  92. .pluginCMBblog .blog-list__item .blog-info {
  93.     width: calc(100% - 190px);
  94.     border-bottom: 1px dashed #707070;
  95.     font-size: 13px;
  96.     color: #333;
  97. }
  98. .pluginCMBblog .blog-list__item .blog_release_date {
  99.     display: inline-block;
  100.     margin-right: 10px;
  101.     color: #707070;
  102. }
  103. .pluginCMBblog .blog-list__item .blog_category {
  104.     display: inline-block;
  105.     padding-left: 0;
  106.     list-style-type: none;
  107. }
  108. .pluginCMBblog .blog-list__item .blog_category a {
  109.     padding: 3px 5px;
  110.     color: white;
  111.     background: #333;
  112. }
  113. .pluginCMBblog .blog-list__item .blog_title_h3 {
  114.     margin: 20px 0;
  115.     line-height: 30px;
  116. }
  117. .pluginCMBblog .blog-list__item .blog-link {
  118.     color: #333;
  119. }
  120. .pluginCMBblog .blog-list__item .blog-link:hover {
  121.     color: #337ab7;
  122. }
  123. .pluginCMBblog .blog-list__item .blog-link .chevron-right {
  124.     display: inline-block;
  125.     width: 18px;
  126.     height: 18px;
  127.     border-radius: 50%;
  128.     background: black;
  129.     text-align: center;
  130. }
  131. .pluginCMBblog .blog-list__item .blog-link .chevron-right .fas {
  132.     color: white;
  133. }
  134. /* .pluginCMBblog .figure__main_image {
  135.     box-shadow: 0px 0px 15px #888;
  136. } */
  137. .pluginCMBblog .figure__main_image img {
  138.     width: 170px;
  139.     height: 170px;
  140.     border-radius: 5px;
  141.     object-fit: cover;
  142. }
  143. .pluginCMBblog a:hover img {
  144.     opacity: .85;
  145. }
  146. @media screen and (max-width: 768px){
  147. /* .pluginCMBblog .item_blog_image {
  148.     width: 100% !important;
  149.     height: 40vw;
  150.     object-fit: cover;
  151.     }
  152.     .side-bar > div {
  153.         width: 100%
  154.     } */
  155.     .ec-shelfRole {
  156.         padding: 0;
  157.     }
  158.     .pluginCMBblog .blog-list__item {
  159.         flex-direction: column;
  160.         align-items: unset;
  161.     }
  162.     .pluginCMBblog .blog-list__item .blog-image {
  163.         width: 70%;
  164.     }
  165.     h5.tag-header {
  166.         margin-top: 40px;
  167.     }
  168. }
  169. @media only screen and (min-width: 768px) {
  170.     .side-bar {
  171.         width: 280px;
  172.     }
  173.     .ec-role {
  174.         display: flex;
  175.         justify-content: flex-start
  176.     }
  177. }
  178. </style>
  179. {% endblock %}
  180. {% block main %}
  181.     <div class="ec-role pluginCMBblog">
  182.         <div class="w-100">
  183.             {# <div class="ec-searchnavRole__topicpath">
  184.                 <ol class="ec-topicpath list_blog_cat">
  185.                     <li class="ec-topicpath__item">
  186.                         <a href="{{ url('cm_blog_pro_page_list') }}">{{ '全て'|trans }}</a>
  187.                     </li>
  188.                     {% for category in categories %}
  189.                 
  190.                     <li class="{{category.class}}">
  191.                         <a href="{{ url('cm_blog_pro_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
  192.                             {{ category.getName|raw }}
  193.                         </a>
  194.                     </li>
  195.                     {% endfor %}
  196.                 </ol>
  197.             </div> #}
  198.     
  199.             {% if pagination.totalItemCount > 0 %}
  200.                 <div class="ec-shelfRole">
  201.                     <ul class="blog-list">
  202.                         {% for blog in pagination %}
  203.                         <li class="blog-list__item">
  204.                             <a href="{{ url('cm_blog_pro_page_detail', {'id': blog.slug ? blog.slug : blog.id}) }}" class="blog-image">
  205.                                 <figure class="figure__main_image">
  206.                                     {% if blog.getMainListImage %}
  207.                                         <img src="{{ asset(blog.getMainListImage|no_image_product, 'save_image') }}" class='item_blog_image'></img>
  208.                                     {% else %}
  209.                                         <img src="{{ asset(''|no_image_product, 'save_image') }}" class='item_blog_image'></img>
  210.                                     {% endif %}
  211.                                     {% if blog.getFigCaption %}
  212.                                         <figcaption>{{ blog.getFigCaption }}</figcaption>
  213.                                     {% endif %}
  214.                                 </figure>
  215.                             </a>
  216.                             <div class="blog-info">
  217.                                 <div class="blog_release_date">{{ blog.release_date|date('Y.m.d')}}</div>
  218.                                 <ul class="blog_category">
  219.                                     {% for category in blog.getBlogCategories %}
  220.                                         <li class="{{category.getCategory.class}}">
  221.                                             <a href="{{ url('cm_blog_pro_page_list', {categories: [category.getCategory().getId()]}) }}" class="list_category_link">
  222.                                             {{ category.getCategory.getName|length > 15 ? category.getCategory.getName|striptags|replace({('&nbsp;'):' '})|slice(0, 15)|raw ~ '...' : category.getCategory.getName|raw }}
  223.                                             </a>
  224.                                         </li>
  225.                                     {% endfor %}        
  226.                                 </ul>
  227.                                 <h3 class="blog_title_h3">{{ blog.getTitle|length > 20 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw }}</h3>  
  228.                                 <p class="blog_body">{{ blog.body|length > 45 ? blog.body|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.body|raw }}</p>
  229.                                 <p style="margin: 10px;text-align: right">
  230.                                     <a href="{{ url('cm_blog_pro_page_detail', {'id': blog.slug ? blog.slug : blog.id}) }}" class="blog-link">
  231.                                         詳しく見る <span class="chevron-right"><i class="fas fa-chevron-right"></i></span>
  232.                                     </a>
  233.                                 </p>
  234.                             </div>
  235.                         </li>
  236.                         {% endfor %}
  237.                     </ul>
  238.                 </div>
  239.                 <div class="ec-pagerRole">
  240.                     {% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_pro_page_list'} %}
  241.                 </div>
  242.             {% endif %}
  243.         </div>
  244.         <div class="side-bar">
  245.             {% set categoryRepository = repository('Plugin\\CMBlogPro42\\Entity\\Category') %}
  246.             {% set blogCategoryRepository = repository('Plugin\\CMBlogPro42\\Entity\\BlogCategory') %}
  247.             <div class="month-archive">
  248.                 <h5 class="tag-header">カテゴリ</h5>
  249.                 <div class="category-link">
  250.                     {% for Category in categoryRepository.findAll() %}
  251.                         <a href="{{ url('cm_blog_pro_page_list', {categories: [Category.getId()]}) }}" class="list_category_link">
  252.                             > {{ Category.getName|raw }}  ({{ blogCategoryRepository.findBy({'Category': Category})|length }})
  253.                         </a>
  254.                     {% endfor %}
  255.                 </div>
  256.             </div>
  257.         </div>
  258.     </div> 
  259. {% endblock %}