app/template/user_data/reading.twig line 4

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {# 投稿リストの取得 #}
  3. {% set post_list = TabaCMSPostList({ page_count: 10, type_data_key: 'news', category_data_key: app.request.query.get('category_data_key') }) %}
  4. {% set category_list = TabaCMSCategoryList({type_data_key:'news'}) %}
  5. {% block javascript %}
  6.     {{ TabaCMSAsset('script.js','script')|raw }}
  7.     <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  8.     <script>
  9.         $(document).ready(function() {
  10.             $('.category-button').on('click', function() {
  11.                 var categoryKey = $(this).data('category-key');
  12.                 var url = new URL(window.location.href);
  13.                 url.searchParams.set('category_data_key', categoryKey);
  14.                 window.location.href = url.href;
  15.             });
  16.         });
  17.     </script>
  18. {% endblock javascript %}
  19. {% block stylesheet %}
  20.     {{ TabaCMSAsset('style.css','style')|raw }}
  21.     <style>
  22.         @media (min-width: 769px) {
  23.             .content-container.sp {
  24.                 display: none;
  25.             }
  26.         }
  27.     </style>
  28. {% endblock stylesheet %}
  29. {% set breadcrumbs = [{'name': 'ニュース'}] %}
  30. {% block main %}
  31.     <div class="flex w-[990px] justify-between mx-auto lg:w-full lg:flex-col lg:items-center lg:px-4">
  32.         <div class="w-[720px] text-[#000000] md:w-full mt-[40px] lg:mt-6">
  33.             <p class="flex justify-center text-[34px] md:text-2xl font-extralight">お知らせ</p>
  34.             <p class="text-[16px] font-[250] items-center mt-6 md:mt-4 mb-10 md:mb-8 md:text-[14px]">
  35.                 商品についての情報、お得な情報などをお届けします。
  36.             </p>
  37.             {% for post in post_list %}
  38.                 <a href="{{ post.getURI }}" class="hover flex gap-2.5 justify-between my-14 md:my-10 md:w-full h-[210px] md:mx-auto md:flex-col md:h-[auto]">
  39.                     <div class="w-[320px] md:w-full">
  40.                         <img src="{{ asset(post.thumbnail|no_image_product, 'save_image') }}" class="w-[320px] h-full md:w-full md:h-[225px] object-cover">
  41.                     </div>
  42.                     <div class="w-[364px] font-[250px] flex flex-col gap-2 md:w-full">
  43.                         <h2 class="text-2xl text-[#000000] md:text-lg font-extralight">{{ post.getTitle }}</h2>
  44.                         {% if post.category %}
  45.                             <time datetime={{ post.getPublicDate|date('Y-m-d') }} class="text-[13px] text-[#666666]">
  46.                                 <span>{{ post.getPublicDate|date('Y.m.d') }}更新<span>
  47.                                 <span class="pl-2">{{ post.category.categoryName }}<span>
  48.                             </time>
  49.                         {% endif %}
  50.                         {% set stripped_body = post.body|striptags %}
  51.                         <p class="text-[14px] text-[#666666]">
  52.                             {{ stripped_body|length > 90 ? stripped_body|slice(0, 90) ~ '...' : stripped_body|raw }}
  53.                         </p>
  54.                     </div>
  55.                 </a>
  56.             {% endfor %}
  57.             {% if post_list.totalItemCount > 0 %}
  58.                 {% include "pager.twig" with {'pages':post_list.paginationData} %}
  59.             {% endif %}
  60.         </div>
  61.         <div class="w-[200px] md:w-full flex flex-col mt-1 md:mt-0">
  62.             <div class="text-sm text-[250] text-[#000000] md:p-[30px] md:mt-6 md:bg-[#F6F6F6]">
  63.                 <p>Category :</p>
  64.                 <div class="mt-[10px] text-[#000000] md:font-[400]">
  65.                 {% for category in category_list %}
  66.                     <p>
  67.                         <button class="category-button w-full text-left my-[2px] underline" data-category-key="{{ category.dataKey }}">
  68.                             {{ category.categoryName }} ({{ category.postCount }})
  69.                         </button>
  70.                     </p>
  71.                 {% endfor %}
  72.                 </div>
  73.             </div>
  74.         </div>
  75.     </div>
  76.         {% set breadcrumbs = [{'name': 'お知らせ・読み物'}] %}
  77.         {% include('Block/breadcrumbs.twig') %}
  78. {% endblock %}