app/template/akracing/web/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. }
  13. .pluginCMBblog .ec-topicpath .ec-topicpath__item{
  14.     display: initial !important;
  15. }
  16. .pluginCMBblog .list_blog_cat li {
  17.     display: initial !important;
  18.     letter-spacing: 0.2rem;
  19.     border-right: 1px solid #ddd;
  20.     font-size: 16px;
  21. }
  22. .pluginCMBblog .list_category_link{
  23.     padding: 0 0.5rem;
  24. }
  25. .pluginCMBblog .list_blog .list_category_link{
  26.     color: #337ab7;
  27.     padding: 0 0.5rem;
  28. }
  29. .pluginCMBblog .blog_category li:last-child{
  30.     border: none;
  31. }
  32. .pluginCMBblog .blog_category{
  33.     margin: 0;
  34.     padding: 0;
  35. }
  36. .pluginCMBblog .blog_category li{
  37.     display: initial;
  38.     border-right: 1px solid #ddd;
  39. }
  40. .pluginCMBblog .list_blog_cat li:last-child {
  41.     border-right: none;
  42. }
  43. .pluginCMBblog .blog_title_h3{
  44.     font-size: 16px !important;
  45.     line-height: 1.4;  
  46.     margin-top: 10px;
  47.     word-break: break-word;
  48. }
  49. @media screen and (max-width: 768px){
  50. .pluginCMBblog .item_blog_image {
  51.     width: 100% !important;
  52.     height: 40vw;
  53.     object-fit: cover;
  54.     }
  55. }
  56. .news_title.new{
  57.     position:relative;
  58. }
  59. .news_title.new::before{
  60.     content: "NEW";
  61.     background-color:#c60a1c;
  62.     padding:0.3em;
  63.     margin:0 0.5em 0 0;
  64.     border-radius:0.3em;
  65.     font-size:10px;
  66. }
  67. </style>
  68. {% endblock %}
  69. {% block main %}
  70. {% set config = repository('Plugin\\CMBlogPro42\\Entity\\Config').get() %}
  71. {% set blogs = repository('Plugin\\CMBlogPro42\\Entity\\Blog').getList(1) %}
  72. {% set categoryLisst = repository('Plugin\\CMBlogPro42\\Entity\\Category').getFrontCategoryList() %}
  73.     <div id="page_user_data" class="ec-role pluginCMBblog">
  74.         <div class="ak-header">
  75.             <div class="ak-pageHeader">
  76.                 <h1>NEWS</h1>
  77.             </div>
  78.         </div><!-- ak-header -->
  79.         <div class="ec-searchnavRole__topicpath"  style="margin:0 0 2em 0;">
  80.         {# 20240805@hanari 出力順を任意にするために変更
  81.             <ol class="ec-topicpath list_blog_cat">
  82.                 <li class="ec-topicpath__item">
  83.                     <a href="{{ url('cm_blog_page_list') }}">{{ '全て'|trans }}</a>
  84.                 </li>
  85.                 
  86.                 {% for category in categories %}
  87.                 
  88.                 <li class="{{category.class}}">
  89.                     <a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
  90.                         {{ category.getName|raw }}
  91.                     </a>
  92.                 </li>
  93.                 {% endfor %}
  94.             </ol>
  95.         #}
  96.             <ol class="ec-topicpath list_blog_cat">
  97.                 <li class="ec-topicpath__item">
  98.                     <a href="{{ url('cm_blog_page_list') }}">{{ '一覧'|trans }}</a>
  99.                 </li>
  100.                 {% for i in [3,1,2,0] %}
  101.                 <li class="{{categories[i].class}}">
  102.                     <a href="{{ url('cm_blog_page_list', {categories: [categories[i].getId()]}) }}" class="list_category_link">
  103.                         {{ categories[i].getName|raw }}
  104.                     </a>
  105.                 </li>
  106.                 {% endfor %}
  107.             </ol>
  108.         </div>
  109.         <div>
  110.         {# dump(pagination) #}
  111.         {# dump(pagination.params == null) #}
  112.         {% if pagination.params == null or pagination.params["categories"][0] is not defined %}
  113.         {# 一覧表示 #}
  114.         {# dump(pagination.params["categories"][0]) #}
  115.             <ul class="news_category">
  116.                 {# for category in categories #}
  117.                 <li>
  118.                 {#
  119.                     <h2>
  120.                     <a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
  121.                         {{ category.getName|raw }}
  122.                     </a>
  123.                     </h2>
  124.                 #}
  125.                     <h2>一覧</h2>
  126.                     <ul class="news_list">
  127.                     {# dump(category.id) #}
  128.                     {# set blogs = repository('Plugin\\CMBlogPro42\\Entity\\Blog').getListNews(category.id,is_granted('ROLE_USER')) #}
  129.                     {% set blogs = repository('Plugin\\CMBlogPro42\\Entity\\Blog').getList() %}
  130.                         {# dump(blogs) #}
  131.                         {% for blog in pagination %}
  132.                         {% set blogCategoryId = 0 %}
  133.                             {# for blogCategory in blog.getBlogCategories #}
  134.                             {# 同一のカテゴリー の 場合 表示 #}
  135.                             {# if category.id == blogCategory.getCategory().getId() #}
  136.                         <li>
  137.                             <span class="news_release_date">{{ blog.release_date|date_day }}</span>                                
  138.                                 {% if blog.linkurl != null %}
  139.                                     {% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
  140.                                 <a class="news_title new" href="{{ blog.linkurl }}" target="_blank">
  141.                                     {% else %}
  142.                                 <a class="news_title" href="{{ blog.linkurl }}" target="_blank">
  143.                                     {% endif %}
  144.                                     {# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
  145.                                     {{ blog.getTitle|raw }}
  146.                                 </a>
  147.                                 {% else %}
  148.                                     {% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
  149.                                 <a class="news_title new" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  150.                                     {% else %}
  151.                                 <a class="news_title" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  152.                                     {% endif %}
  153.                                     {# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
  154.                                     {{ blog.getTitle|raw }}
  155.                                 </a>
  156.                                 {% endif %}                            
  157.                         </li>
  158.                             {# endif #}
  159.                             {# endfor #}
  160.                         {% endfor %}
  161.                         {#
  162.                         <li class="more">
  163.                             <a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
  164.                                 過去の記事 >
  165.                             </a>
  166.                         </li>
  167.                         #}
  168.                     </ul>
  169.                 </li>
  170.             <div class="ec-pagerRole">
  171.                 {% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_page_list'} %}
  172.             </div>
  173.                 {# endfor #}
  174.             </ul>
  175.         {% else %}{# 一覧表示 #}
  176.         {# カテゴリー表示 #}
  177.             {# dump(pagination) #}
  178.         {# dump(pagination.params["categories"][0]) #}
  179.         {% set categoriesId = pagination.params["categories"][0] %}
  180.             <ul class="news_category">
  181.                 {% for category in categories %}
  182.                 {% if categoriesId == category.id %}
  183.                 <li class="{{category.class}}">
  184.                     <h2>
  185.                     <a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
  186.                         {{ category.getName|raw }}
  187.                     </a>
  188.                     </h2>
  189.                     <ul class="news_list">
  190.                         {% for blog in pagination %}
  191.                         {% set blogCategoryId = 0 %}
  192.                             {% for blogCategory in blog.getBlogCategories %}
  193.                             {# 同一のカテゴリー の 場合 表示 #}
  194.                             {% if category.id == blogCategory.getCategory().getId() %}
  195.                         {% if is_granted('ROLE_USER') %}{# 会員限定 #}
  196.                         <li>
  197.                             <span class="news_release_date">{{ blog.release_date|date_day }}</span>
  198.                                 {% if blog.linkurl != null %}
  199.                                     {% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
  200.                                 <a class="news_title new" href="{{ blog.linkurl }}" target="_blank">
  201.                                     {% else %}
  202.                                 <a class="news_title" href="{{ blog.linkurl }}" target="_blank">
  203.                                     {% endif %}
  204.                                     {# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
  205.                                     {{ blog.getTitle|raw }}
  206.                                 </a>
  207.                                 {% else %}
  208.                                     {% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
  209.                                 <a class="news_title new" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  210.                                     {% else %}
  211.                                 <a class="news_title" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  212.                                     {% endif %}
  213.                                     {# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
  214.                                     {{ blog.getTitle|raw }}
  215.                                 </a>
  216.                                 {% endif %}                                
  217.                         </li>
  218.                         {% else %}{# 会員限定 一般 #}{% if blog.members != 1 %}
  219.                         <li>
  220.                             <span class="news_release_date">{{ blog.release_date|date_day }}</span>
  221.                                 {% if blog.linkurl != null %}
  222.                                     {% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
  223.                                 <a class="news_title new" href="{{ blog.linkurl }}" target="_blank">
  224.                                     {% else %}
  225.                                 <a class="news_title" href="{{ blog.linkurl }}" target="_blank">
  226.                                     {% endif %}
  227.                                     {# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
  228.                                     {{ blog.getTitle|raw }}
  229.                                 </a>
  230.                                 {% else %}
  231.                                     {% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
  232.                                 <a class="news_title new" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  233.                                     {% else %}
  234.                                 <a class="news_title" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  235.                                     {% endif %}
  236.                                     {# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
  237.                                     {{ blog.getTitle|raw }}
  238.                                 </a>
  239.                                 {% endif %}                                
  240.                         </li>
  241.                         {% endif %}{% endif %}
  242.                             {% endif %}
  243.                             {% endfor %}
  244.                         {% endfor %}
  245.                     </ul>
  246.                 </li>
  247.                 {% endif %}
  248.                 {% endfor %}
  249.             </ul>
  250.             <div class="ec-pagerRole">
  251.                 {% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_page_list'} %}
  252.             </div>
  253.         {% endif %}{# カテゴリー表示 #}
  254.         </div>
  255.         
  256. {#
  257.         {% if pagination.totalItemCount > 0 %}
  258.             <div class="ec-shelfRole" style="padding-top: 20px">
  259.                 <ul class="ec-shelfGrid list_blog">
  260.                     {% for blog in pagination %}
  261.                     <li class="ec-shelfGrid__item">
  262.                         <a href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  263.                             <figure class="figure__main_image">
  264.                             {% if blog.getMainListImage %}
  265.                                 <img src="{{ asset(blog.getMainListImage|no_image_product, 'save_image') }}" class='item_blog_image'></img>
  266.                                 {% else %}
  267.                                 <img src="{{ asset(''|no_image_product, 'save_image') }}" class='item_blog_image'></img>
  268.                             {% endif %}
  269.                             </figure>
  270.                         </a>
  271.                         <h3 class="blog_title_h3">
  272.                             <a href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
  273.                                 {{ blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({('&nbsp;'):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw }}
  274.                             </a>
  275.                         </h3>  
  276.                         <ul class="blog_category">
  277.                                 {% for category in blog.getBlogCategories %}
  278.                                     <li class="{{category.getCategory.class|raw}}">
  279.                                         <a href="{{ url('cm_blog_page_list', {categories: [category.getCategory().getId()]}) }}" class="list_category_link">
  280.                                         {{ category.getCategory.getName|length > 15 ? category.getCategory.getName|striptags|replace({('&nbsp;'):' '})|slice(0, 15)|raw ~ '...' : category.getCategory.getName|raw }}
  281.                                         </a>
  282.                                     </li>
  283.                                 {% endfor %}
  284.                         </ul>
  285.                     </li>
  286.                     {% endfor %}
  287.                 </ul>
  288.             </div>
  289.             <div class="ec-pagerRole">
  290.                 {% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_page_list'} %}
  291.             </div>
  292.         {% endif %}
  293. #}
  294.     </div> 
  295. {% endblock %}