app/template/default/Special/detail.twig line 1

Open in your IDE?
  1. {% extends 'default_frame.twig' %}
  2. {% block stylesheet %}
  3.     <link rel="stylesheet" href="/html/template/default/assets/css/content.css">
  4.     <link rel="stylesheet" href="/html/template/default/assets/css/frame03.css">
  5. {% endblock %}
  6. {% set categories = [
  7.         'essay',
  8.         'interview',
  9.         'report',
  10.         'guide',
  11.         'philosophy'
  12.     ]
  13. %}
  14. {% block javascript %}
  15.     <script>
  16.         $(function(){
  17.             $('.slide-img:not(".slide-img-slow")').slick({
  18.             autoplay: true,
  19.             autoplaySpeed: 3000,
  20.             arrows: false,
  21.             dots: false,
  22.             infinite: true,
  23.             speed: 800,
  24.             slidesToShow: 1,
  25.             variableWidth: true,
  26.             centerMode: true,
  27.             responsive: [
  28.             {
  29.                 breakpoint: 750,
  30.                 settings: {
  31.                 variableWidth: true,
  32.                 centerMode: true,
  33.                 }
  34.             }
  35.             ]
  36.         });
  37.         $('.slide-img-slow > li:last-child > img').on('load',function(){
  38.             setTimeout(function(){
  39.             $('.slide-img-slow').not('.slick-initialized').slick({
  40.                 autoplay: true,
  41.                 autoplaySpeed: 0,
  42.                 arrows: false,
  43.                 dots: false,
  44.                 speed: 18000,
  45.                 infinite: true,
  46.                 cssEase: 'linear',
  47.                 slidesToShow: 1,
  48.                 variableWidth: true,
  49.                 centerMode: true,
  50.                 draggable: false,
  51.                 touchMove: false,
  52.                 pauseOnFocus: false,
  53.                 pauseOnHover: false,
  54.             });
  55.             $('.slide-img-slow').css('opacity',1);
  56.             },1000);
  57.         });
  58.         $('.slide-img-slow > li > img').each(function(){
  59.             var ctrl = $(this);
  60.             ctrl.attr('src',ctrl.data('src'));
  61.         });
  62.         });
  63.     </script>
  64.     {% if Post.category[0].slug in categories %}
  65.         <script>
  66.             $(document).ready(function () {
  67.                 const postSlug = '{{ Post.category[0].slug }}';
  68.                 console.log(postSlug);
  69.                 $('#page_special_detail').addClass('bg-' + postSlug);
  70.             });
  71.         </script>
  72.     {% endif %}
  73.     <script>
  74.         $(function () {
  75.             $("#share-menu-button").on('click', function () {
  76.                 $("#share-menu").fadeToggle();
  77.                 copyLinkText('リンクをコピー');
  78.             });
  79.         });
  80.         function copyUrl() {
  81.             const url = location.href;
  82.             navigator.clipboard.writeText(url);
  83.             copyLinkText('コピーしました');
  84.             setTimeout(function () {
  85.             copyLinkText('リンクをコピー');
  86.             }, 2000);
  87.         }
  88.         function openLineShare() {
  89.             const lineUrl = 'https://social-plugins.line.me/lineit/share?url=';
  90.             const url = location.href;
  91.             window.open(`${lineUrl}${url}`)
  92.         }
  93.         function openMail() {
  94.             const url = location.href;
  95.             const mailto = `mailto:?body=${url}`;
  96.             window.open(mailto);
  97.         }
  98.         function copyLinkText(text) {
  99.             $("#copy-link > span").text(text);
  100.         }
  101.     </script>
  102. {% endblock %}
  103. {% block main %}
  104.     <div
  105.         class="second-wrap white-wrap w-full flex flex-col items-center justify-center font-extralight mx-auto animate-slideIn">
  106.         <!-- KV -->
  107.         <div id="section-kv" class="w-full z-10">
  108.             <div class="flex flex-col items-center w-full">
  109.                 <img src="{{ Post.special_kv_pc.url }}" alt="{{ Post.special_kv_pc.alt }}" class="sm:hidden object-cover h-[450px] w-full overflow-hidden">
  110.                 <img src="{{ Post.special_kv_sp.url }}" alt="{{ Post.special_kv_sp.alt }}" class="hidden sm:block w-full object-cover h-[640px]">
  111.                 <div class="max-w-[880px] w-full lg:w-[86.6vw]  md:mx-6 bg-black bg-opacity-80 text-white px-12 py-14 md:py-8 md:px-6 flex-col flex mt-[-24px] relative">
  112.                     <p class="text-end text-[#B0B0B0] text-sm md:text-xs absolute top-[4px] right-[8px]">{{ Post.post_date|date('Y/m/d') }}</p>
  113.                     <div class="flex items-center border border-white w-fit mb-3 text-sm sm:text-xs px-3 py-[2px]">
  114.                         <p class="{% if Post.sub_category is not empty %} after:content-['|'] {% endif %}">{{ Post.category[0].name }}
  115.                         </p>
  116.                         {% if Post.sub_category is not empty %}
  117.                             <span class="{% if Post.sub_category is not empty %} ml-1 {% endif %}">{{ Post.sub_category.name }}</span>
  118.                         {% endif %}
  119.                     </div>
  120.                     <h1 class="text-3xl md:text-xl leading-loose tracking-[5px]">{{ Post.post_title|raw }}</h1>
  121.                 </div>
  122.             </div>
  123.         </div>
  124.         <div id="page_special_detail" class="w-[100vw] mx-[-50vw] h-fit relative flex flex-col items-center bg-top mt-[-180px] lg:px-6 md:pt-[100px]">
  125.             <div class="section-inner">
  126.                 <div class="section-cont text-[10px]">
  127.                     {{ Post.filter_content|raw }}
  128.                 </div>
  129.             </div>
  130.         </div>
  131.         <div class="max-w-[880px] w-full mx-auto md:px-3">
  132.             <div class="w-full flex justify-between text-sm py-28 items-center">
  133.                 {% if PrevPost is not empty %}
  134.                     <a href="{{ path('special_post',{'id':PrevPost}) }}" class="flex items-center gap-4 md:gap-2">
  135.                         <img src="{{asset('/html/template/default/assets/img/special/arrow-prev.svg')}}" alt="" class="mt-1 md:w-10">
  136.                         <p class="whitespace-nowrap text-xs">前の記事へ</p>
  137.                     </a>
  138.                 {% else %}
  139.                     <div class="w-[134px] opacity-0"></div>
  140.                 {% endif %}
  141.                     <div class="md:mt-16 whitespace-nowrap">
  142.                         <a href="{{ path('special_posts') }}" class="border border-[#DFDFDF] px-3 py-1 md:text-xs md:px-1 text-center">記事一覧へ</a>
  143.                     </div>
  144.                 {% if NextPost is not empty %}
  145.                     <a href="{{ path('special_post',{'id':NextPost}) }}" class="flex items-center gap-4 md:gap-2">
  146.                         <p class="whitespace-nowrap text-xs">次の記事へ</p>
  147.                         <img src="{{asset('/html/template/default/assets/img/special/arrow-next.svg')}}" alt="" class="mt-1 md:w-10">
  148.                     </a>
  149.                 {% else %}
  150.                     <div class="w-[134px] opacity-0"></div>
  151.                 {% endif %}
  152.             </div>
  153.             <hr class="bg-[#DFDFDF] w-[100vw] mx-[calc(50%-50vw)] px-[calc(50%-50vw)]">
  154.             <div class="w-full mt-24 md:mt-8 flex flex-col items-center">
  155.                 <h2 class="text-xl mb-10 md:mb-6 md:text-sm">SHARE</h2>
  156.                 {# TODO:シェアボタン #}
  157.                 <ul id="share-menu" class="flex mb-8 items-center">
  158.                     <li class="hover cursor-pointer p-3 " onclick="openLineShare()">
  159.                         <img class="h-8 w-8" src="{{ asset('assets/icon/LINE_LOGO.svg') }}">
  160.                     </li>
  161.                     <li class="hover cursor-pointer p-3" onclick="openMail()">
  162.                         <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewbox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-8">
  163.                             <path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"/>
  164.                         </svg>
  165.                     </li>
  166.                     <li id="copy-link" class="hover cursor-pointer p-3" onclick="copyUrl()">
  167.                         <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" fill="currentColor" class="size-7">
  168.                             <path fill-rule="evenodd" d="M19.902 4.098a3.75 3.75 0 0 0-5.304 0l-4.5 4.5a3.75 3.75 0 0 0 1.035 6.037.75.75 0 0 1-.646 1.353 5.25 5.25 0 0 1-1.449-8.45l4.5-4.5a5.25 5.25 0 1 1 7.424 7.424l-1.757 1.757a.75.75 0 1 1-1.06-1.06l1.757-1.757a3.75 3.75 0 0 0 0-5.304Zm-7.389 4.267a.75.75 0 0 1 1-.353 5.25 5.25 0 0 1 1.449 8.45l-4.5 4.5a5.25 5.25 0 1 1-7.424-7.424l1.757-1.757a.75.75 0 1 1 1.06 1.06l-1.757 1.757a3.75 3.75 0 1 0 5.304 5.304l4.5-4.5a3.75 3.75 0 0 0-1.035-6.037.75.75 0 0 1-.354-1Z" clip-rule="evenodd"/>
  169.                         </svg>
  170.                     </li>
  171.                 </ul>
  172.             </div>
  173.         </div>
  174.         <div class="w-full max-w-[1120px] lg:px-12 mt-[130px] md:mt-10 mb-8 md:mb-0">
  175.             <ul id="breadcrumbs" class="border-t border-[#EFEFEF] py-5 md:py-4 w-full md:text-xs text-sm tracking-widest flex items-center gap-x-1">
  176.                 <li>
  177.                     <a href="{{ url('homepage') }}" class="hover">
  178.                         <span>HOME</span>
  179.                     </a>
  180.                 </li>
  181.                 <span>/</span>
  182.                 <li>
  183.                     <a href={{url('special_posts')}} class="hover">
  184.                         <span>特集</span>
  185.                     </a>
  186.                 </li>
  187.                 <span>/</span>
  188.                 <li>
  189.                     <span>{{ Post.post_title|raw }}</span>
  190.                 </li>
  191.             </ul>
  192.         </div>
  193.     </div>
  194. {% endblock %}