templates/forum/forum_post/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ post.title }} | Avopy{% endblock %}
  3. {% block stylesheets %}
  4.     <style>
  5.         .intro-banner:after, .intro-banner:before {
  6.             background: initial;
  7.             background-color: white !important;
  8.         }
  9.         .blog-post-content {
  10.             padding: 16px;
  11.         }
  12.         .comment-content {
  13.             padding: initial;
  14.         }
  15.         .reply-comment {
  16.             margin-top: 10px !important;
  17.         }
  18.         .report_comment {
  19.             display: inline;
  20.             background-color: #f0f0f0;
  21.             padding: 5px 16px;
  22.             line-height: 22px;
  23.             font-size: 14px;
  24.             color: #666;
  25.             font-weight: 500;
  26.             position: absolute;
  27.             right: 72px;
  28.             top: 15px;
  29.             border-radius: 4px;
  30.         }
  31.         .report_post {
  32.             display: inline;
  33.             background-color: #f0f0f0;
  34.             padding: 5px 16px;
  35.             line-height: 22px;
  36.             font-size: 14px;
  37.             color: #666;
  38.             font-weight: 500;
  39.             position: absolute;
  40.             right: 70px;
  41.             top: 15px;
  42.             border-radius: 4px;
  43.         }
  44.         .report_reply {
  45.             display: inline;
  46.             background-color: #f0f0f0;
  47.             padding: 5px 16px;
  48.             line-height: 22px;
  49.             font-size: 14px;
  50.             color: #666;
  51.             font-weight: 500;
  52.             position: absolute;
  53.             right: 72px;
  54.             top: 15px;
  55.             border-radius: 4px;
  56.         }
  57.         .comments ul li, .comments ul li ul li, .comments ul li ul li ul li, .comments ul li ul li ul li {
  58.             margin: 20px 0 0 0px;
  59.         }
  60.         .comments ul li ul {
  61.             margin: 0 0 0 25px;
  62.         }
  63.         @media screen and (max-width: 500px) {
  64.             .comment-content {
  65.                 padding: inherit;
  66.             }
  67.         }
  68.         blockquote {
  69.              margin: initial;
  70.         }
  71.         .comment-by span.date {
  72.              display: initial;
  73.         }
  74.         .btn-small {
  75.             padding: 6px 15px !important;
  76.             line-height: 20px !important;
  77.             font-size: 13px !important;
  78.             font-weight: 600 !important;
  79.             margin: 0 !important;
  80.             display: inline-block !important;
  81.         }
  82.     </style>
  83.     {% if post.closed %}
  84.         <style>
  85.             .is-closed {
  86.                 display: none !important;
  87.             }
  88.         </style>
  89.     {% endif %}
  90.     {#DIV POST CONTENT#}
  91.     <style>
  92.         #post_content p,
  93.         #post_content ul,
  94.         #post_content li,
  95.         #post_content table,
  96.         #post_content td,
  97.         #post_content th,
  98.         #post_content ol {
  99.             font-size: 20px; /* Taille de police pour les listes */
  100.         }
  101.     </style>
  102. {% endblock %}
  103. {% block body %}
  104.     <div id="main-forum">
  105.         <div class="intro-banner "
  106.              style="padding: inherit; padding-top: 31px; background-color: white;">
  107.         </div>
  108.         <div class="col-12">
  109.             <!-- Breadcrumbs -->
  110.             <nav id="breadcrumbs" class="dark">
  111.                 <ul>
  112.                     <li>
  113.                         <a href="{{ path('forum_public_country', {'country' : "uae"}) }}">Forum</a>
  114.                     </li>
  115.                     <li>
  116.                         <a href="{{ path('app_forum_forum_topic_show',{
  117.                             'countryMin' : post.topic.countryMin,
  118.                             'slug' : post.topic.slug
  119.                         }) }}">
  120.                             {{ post.topic.name }}
  121.                         </a>
  122.                     </li>
  123.                     <li>
  124.                         {{ post.title }}
  125.                     </li>
  126.                 </ul>
  127.             </nav>
  128.         </div>
  129.         <div class="section margin-bottom-20 margin-top-65 padding-left-20 padding-right-20">
  130.             <div class="container ">
  131.                 <div class="row">
  132.                     <div class="col-lg-12 col-md-12 col-sm-12">
  133.                         <div class="blog-post single-post">
  134.                             {% if currentForumUser %}
  135.                                 <span
  136.                                     class="add-post-favorite bookmark-icon {{ post.favorite(currentForumUser) ? "bookmarked" : "" }}"
  137.                                     data-post-id="{{ post.id }}"
  138.                                 ></span>
  139.                             {% endif %}
  140.                             {% if not currentForumUser %}
  141.                                 <a href="{{ path('register_freelance') }}" class="report_comment"
  142.                                    data-tippy-placement="left" data-tippy="" data-original-title="Report"
  143.                                    title="Report"
  144.                                 >
  145.                                     <span class="hide-on-mobile">Report this topic</span> <i class="icon-feather-alert-triangle"></i>
  146.                                 </a>
  147.                             {% else %}
  148.                                 <a href="#report-dialog" class="report_post popup-with-zoom-anim"
  149.                                    data-tippy-placement="left" data-tippy="" data-original-title="Report"
  150.                                    title="Report"
  151.                                    data-post-id="{{ post.id }}"
  152.                                 >
  153.                                     <span class="hide-on-mobile">Report this topic</span> <i class="icon-feather-alert-triangle"></i>
  154.                                 </a>
  155.                             {% endif %}
  156.                             <!-- Blog Post Content -->
  157.                             <div class="blog-post-content">
  158.                                 <div class="row">
  159.                                     <div class="col-md-9 col-lg-9">
  160.                                         <h1 class="margin-bottom-10" style="font-size: 40px">{{ post.title }}</h1>
  161.                                     </div>
  162.                                 </div>
  163.                                 <div class="blog-post-info-list margin-bottom-20 ">
  164.                                     <span class="forum_avatar ripple-effect-dark" style="top: 8px"
  165.                                           title="{{ post.forumUser.alias }}"
  166.                                     >
  167.                                         {{ post.forumUser.avatarSpanName }}
  168.                                     </span>
  169.                                     <span class="blog-post-info">{{ post.timeCreateString }}</span>
  170.                                     {% if post.closedAt %}
  171.                                         <span class="blog-post-info text-blue" style="">{{ post.timeCloseString }}</span>
  172.                                     {% endif %}
  173.                                     {% if not post.actived %}
  174.                                         <br>
  175.                                         <span class="text-error blog-post-info "
  176.                                            style="background-color: #de5959; color: white">
  177.                                             <b>Pending validation by the admin</b>
  178.                                         </span>
  179.                                     {% endif %}
  180.                                 </div>
  181.                                 <div id="post_content" class="margin-top-20 margin-bottom-10 margin-left-10 margin-left-10 text-black">
  182.                                     {{ post.content|raw }}
  183.                                 </div>
  184.                                 <div>
  185.                                     <br>
  186.                                     {% if not currentForumUser %}
  187.                                         <a href="{{ path('register_freelance') }}" class="button btn-small is-closed">
  188.                                             <i class="icon-line-awesome-reply"></i>
  189.                                             Reply this topic
  190.                                         </a>
  191.                                     {% elseif post.forumUser != currentForumUser %}
  192.                                         <a href="#forum_comment_content" class="button btn-small is-closed">
  193.                                             <i class="icon-line-awesome-reply"></i>
  194.                                             Reply this topic
  195.                                         </a>
  196.                                     {% endif %}
  197.                                     {% if is_granted('ROLE_ADMIN') %}
  198.                                         <a href="{{ path('forum_admin_post_not_active_delete', {'id' : post.id}) }}"
  199.                                            onclick="if (confirm('Confirmer la suppression du post?')){return true;}else{event.stopPropagation(); event.preventDefault();}"
  200.                                            class="delete button red ico" title="Supprimer le post">
  201.                                             <i class="icon-feather-trash-2"></i> Supprimer
  202.                                         </a>
  203.                                     {% endif %}
  204.                                     {% if post.forumUser == currentForumUser and not post.closed %}
  205.                                         <a href="{{ path('app_forum_forum_post_edit', {
  206.                                             'country' : post.topic.countryMin,
  207.                                             'id' : post.id
  208.                                         }) }}" class="button btn-small gray">
  209.                                             <i class="icon-line-awesome-comment"></i>
  210.                                             Edit this topic
  211.                                         </a>
  212.                                     {% endif %}
  213.                                     {% if post.forumUser == currentForumUser and not post.closed %}
  214.                                         <a href="#dialog-post-close" class="button btn-small skyblue popup-with-zoom-anim"
  215.                                         style="float: right">
  216.                                             <i class="icon-line-awesome-close"></i>
  217.                                             Close the topic
  218.                                         </a>
  219.                                     {% endif %}
  220.                                 </div>
  221.                             </div>
  222.                         </div>
  223.                     </div>
  224.                 </div>
  225.             </div>
  226.             <div class="container ">
  227.                 <div class="row">
  228.                     <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
  229.                         <section class="comments">
  230.                             <h3 class="margin-top-25 margin-bottom-0">Replies
  231.                                 <span class="comments-amount">({{ post.comments|length }})</span>
  232.                             </h3>
  233.                             <ul>
  234.                                 {% for comment in post.comments %}
  235.                                     <li class="width-100">
  236.                                         <div class="comment-content">
  237.                                             <blockquote class="text-black">
  238.                                                 <div class="comment-by">
  239.                                                     <span class="forum_avatar ripple-effect-dark" style="top: 8px"
  240.                                                           title="{{ comment.forumUser.alias }}"
  241.                                                     >
  242.                                                         {{ comment.forumUser.avatarSpanName }}
  243.                                                     </span>
  244.                                                     <span class="date">{{ comment.timeCreateString }}</span>
  245.                                                     {% if not currentForumUser %}
  246.                                                         <a href="{{ path('register_freelance') }}" class="report_comment"
  247.                                                            data-tippy-placement="left" data-tippy=""
  248.                                                            data-original-title="Report"
  249.                                                            title="Report"
  250.                                                         >
  251.                                                             <span class="hide-on-mobile"></span> <i class="icon-feather-alert-triangle"></i>
  252.                                                         </a>
  253.                                                     {% else %}
  254.                                                         <a href="#report-dialog" class="report_comment popup-with-zoom-anim"
  255.                                                            data-tippy-placement="left" data-tippy=""
  256.                                                            data-original-title="Report"
  257.                                                            title="Report"
  258.                                                            data-comment-id="{{ comment.id }}"
  259.                                                         >
  260.                                                             <span class="hide-on-mobile"></span> <i class="icon-feather-alert-triangle"></i>
  261.                                                         </a>
  262.                                                     {% endif %}
  263.                                                     {% if is_granted('ROLE_ADMIN') %}
  264.                                                         <a href="{{ path('forum_admin_comment_delete', {'id' : comment.id, 'redirect' : 'post'}) }}"
  265.                                                            onclick="if (confirm('Confirmer la suppression du reply?')){return true;}else{event.stopPropagation(); event.preventDefault();}"
  266.                                                            class="delete red ico" title="Supprimer le reply" style="color: #e53038">
  267.                                                             <i class="icon-feather-trash-2"></i> Supprimer
  268.                                                         </a>
  269.                                                     {% endif %}
  270.                                                 </div>
  271.                                                 <p>{{ comment.content|nl2br }}</p>
  272.                                                 {% if not currentForumUser %}
  273.                                                     <a href="{{ path('register_freelance') }}" class="button ripple-effect btn-small is-closed">
  274.                                                         <i class="icon-line-awesome-reply"></i>
  275.                                                         Reply
  276.                                                     </a>
  277.                                                 {% else %}
  278.                                                     <a type="button" class="button ripple-effect btn_reply btn-small text-white is-closed"
  279.                                                        data-comment-id="{{ comment.id }}">
  280.                                                         <i class="icon-line-awesome-reply"></i>
  281.                                                         Reply
  282.                                                     </a>
  283.                                                 {% endif %}
  284.                                                 {% if currentForumUser and not post.closedAt %}
  285.                                                     <div class="div_reply" data-reply-id="{{ comment.id }}"
  286.                                                          style="display: none">
  287.                                                         <br>
  288.                                                         <div class="row">
  289.                                                             <div class="col-lg-8 col-md-8 col-sm-12">
  290.                                                                 {% set formReply = formReplys['comment_'~comment.id] %}
  291.                                                                 {{ form_start(formReply, {
  292.                                                                     'action' : path('app_forum_forum_comment_reply', {'id' : comment.id })
  293.                                                                 }) }}
  294.                                                                 {{ form_widget(formReply.content, {
  295.                                                                     'attr' : {
  296.                                                                         'placeholder' : "Reply",
  297.                                                                         'cols' : "10",
  298.                                                                         'rows' : "1"
  299.                                                                     }
  300.                                                                 }) }}
  301.                                                                 <!-- Button -->
  302.                                                                 <button
  303.                                                                     class="button button-sliding-icon ripple-effect margin-bottom-40"
  304.                                                                     type="submit"
  305.                                                                     style="width: 176.203px;">
  306.                                                                     Reply
  307.                                                                     <i class="icon-material-outline-arrow-right-alt"></i>
  308.                                                                 </button>
  309.                                                                 {{ form_end(formReply) }}
  310.                                                             </div>
  311.                                                         </div>
  312.                                                     </div>
  313.                                                 {% endif %}
  314.                                                 <ul>
  315.                                                     {% for reply in comment.commentReplies %}
  316.                                                         <li class="reply-comment">
  317.                                                             <div class="comment-content-reply">
  318.                                                                 <div class="arrow-comment"></div>
  319.                                                                 <div class="comment-by">
  320.                                                                     <span class="forum_avatar ripple-effect-dark" style="top: 8px"
  321.                                                                           title="{{ reply.forumUser.alias }}"
  322.                                                                     >
  323.                                                                         {{ reply.forumUser.avatarSpanName }}
  324.                                                                     </span>
  325.                                                                     <span class="date">
  326.                                                                         {{ reply.timeCreateString }}
  327.                                                                     </span>
  328.                                                                 </div>
  329.                                                                 <p class="text-black">
  330.                                                                     {{ reply.content|nl2br }}
  331.                                                                 </p>
  332.                                                                 {% if not currentForumUser %}
  333.                                                                     <a href="{{ path('register_freelance') }}" class="report_reply"
  334.                                                                        data-tippy-placement="left" data-tippy=""
  335.                                                                        data-original-title="Report"
  336.                                                                        title="Report"
  337.                                                                     >
  338.                                                                         <span class="hide-on-mobile"></span> <i class="icon-feather-alert-triangle"></i>
  339.                                                                     </a>
  340.                                                                 {% else %}
  341.                                                                     <a href="#report-dialog" class="report_reply popup-with-zoom-anim"
  342.                                                                        data-tippy-placement="left" data-tippy=""
  343.                                                                        data-original-title="Report"
  344.                                                                        title="Report"
  345.                                                                        data-reply-id="{{ comment.id }}"
  346.                                                                     >
  347.                                                                         <span class="hide-on-mobile"></span> <i class="icon-feather-alert-triangle"></i>
  348.                                                                     </a>
  349.                                                                 {% endif %}
  350.                                                                 {% if is_granted('ROLE_ADMIN') %}
  351.                                                                     <a href="{{ path('forum_admin_commentReply_delete', {'id' : reply.id, 'redirect' : 'post'}) }}"
  352.                                                                        onclick="if (confirm('Confirmer la suppression du reply?')){return true;}else{event.stopPropagation(); event.preventDefault();}"
  353.                                                                        class="delete red ico" title="Supprimer le reply" style="color: #e53038">
  354.                                                                         <i class="icon-feather-trash-2"></i> Supprimer
  355.                                                                     </a>
  356.                                                                 {% endif %}
  357.                                                             </div>
  358.                                                         </li>
  359.                                                     {% endfor %}
  360.                                                 </ul>
  361.                                             </blockquote>
  362.                                         </div>
  363.                                     </li>
  364.                                 {% endfor %}
  365.                             </ul>
  366.                         </section>
  367.                     </div>
  368.                 </div>
  369.             </div>
  370.         </div>
  371.         {% if currentForumUser and not post.closedAt and post.forumUser != currentForumUser %}
  372.             <div class="container ">
  373.                 <div class="row">
  374.                     <div class="col-lg-8 col-md-8 col-sm-12">
  375.                         <h3 class="margin-bottom-30">Add reply</h3>
  376.                         <!-- Form -->
  377.                         {{ form_start(formComment) }}
  378.                         {{ form_widget(formComment.content, {
  379.                             'attr' : {
  380.                                 'placeholder' : "Reply",
  381.                                 'cols' : "30",
  382.                                 'rows' : "5"
  383.                             }
  384.                         }) }}
  385.                         <!-- Button -->
  386.                         <button class="button button-sliding-icon ripple-effect margin-bottom-40" type="submit"
  387.                                 style="width: 176.203px;">
  388.                             Reply
  389.                             <i class="icon-material-outline-arrow-right-alt"></i>
  390.                         </button>
  391.                         {{ form_end(formComment) }}
  392.                     </div>
  393.                 </div>
  394.             </div>
  395.         {% endif %}
  396.     </div>
  397.     <!-- Features Cities -->
  398.     {% include('forum/forum_post/layout/_report_popup.html.twig') %}
  399.     {#CLOSED POST#}
  400.     <div id="dialog-post-close" class="zoom-anim-dialog mfp-hide dialog-with-tabs custom-dialog">
  401.         <div class="sign-in-form">
  402.             <ul class="popup-tabs-nav">
  403.                 <li><a href="#tab1">Close</a></li>
  404.             </ul>
  405.             <div class="popup-tabs-container">
  406.                 <div class="popup-tab-content" id="tab1">
  407.                     <h3 class="margin-bottom-10">Are you sure you want to close this topic?</h3>
  408.                     <p>
  409.                         No one will be able to answer and you will not be able to reopen it.
  410.                     </p>
  411.                     <div class="d-flex justify-content-end">
  412.                         <a href="{{ path('app_forum_forum_post_closed', {'id' : post.id}) }}" class="button">Close</a>
  413.                     </div>
  414.                 </div>
  415.             </div>
  416.         </div>
  417.     </div>
  418. {% endblock %}
  419. {% block footer %}{% endblock %}
  420. {% block javascripts %}
  421.     {# ------ REPLY COMMENT ------ #}
  422.     <script>
  423.         // Sélection de tous les boutons de réponse
  424.         const replyButtons = document.querySelectorAll('.btn_reply');
  425.         // Ajouter un gestionnaire d'événement à chaque bouton de réponse
  426.         replyButtons.forEach(button => {
  427.             button.addEventListener('click', () => {
  428.                 const commentId = button.getAttribute('data-comment-id');
  429.                 const replyDiv = document.querySelector(`.div_reply[data-reply-id="${commentId}"]`);
  430.                 if (replyDiv) {
  431.                     replyDiv.style.display = (replyDiv.style.display === 'none') ? 'block' : 'none';
  432.                     // Mettre le focus sur le textarea dans le div de réponse
  433.                     const textarea = replyDiv.querySelector('textarea');
  434.                     if (textarea) {
  435.                         textarea.focus();
  436.                     }
  437.                 }
  438.             });
  439.         });
  440.     </script>
  441.     {# ------ FORUM FAVORITE# ----- #}
  442.     {% include('forum/forum_post/_script.html.twig') %}
  443.     {# ------ REPORT SCRIPT # ----- #}
  444.     {% include('forum/forum_post/layout/_report_script.html.twig') %}
  445. {% endblock %}