templates/Slivki/mobile/comment/list.html.twig line 1

Open in your IDE?
  1. {% set isLiveComments = isLiveComments is defined  %}
  2. {% set showBanners = showBanners is defined and not isLiveComments %}
  3. {% for comment in comments %}
  4.     {{ _self.recursiveComment(comment, isLiveComments, 1) }}
  5.     {% if showBanners %}
  6.         <span id="commentBannerPlaceHolder{{ loop.index }}" class="hidden"></span>
  7.     {% endif %}
  8. {% endfor %}
  9. {% if pagination is defined and pagination %}
  10.     {{ pagination|raw }}
  11. {% endif %}
  12. {% if hasMore and comments|length > 0 %}
  13.     <div id="afterCommentsBlock" class="row no-gutters">
  14.         {% set lastEntityID = 0 %}
  15.         {% set lastComment = comments|last %}
  16.         {% set showAddCommentBtn = not isLiveComments and not is_granted(constant('Slivki\\Entity\\UserGroup::COMMENTS_BANNED_ROLE_NAME')) and lastComment.getTypeID() != constant('Slivki\\Entity\\Comment::TYPE_MALL_BRAND_COMMENT') %}
  17.         {% if not isLiveComments %}
  18.             {% set lastEntityID = comments|last.getEntityID() %}
  19.             {% set lastComment = comments|last %}
  20.         {% endif %}
  21.         <div class="{{ showAddCommentBtn ? 'col-6' : 'col-12' }} p-1">
  22.             <button class="btn btn-block alt-font bg-white border" onclick="loadComments({{ lastEntityID }}, {{ lastComment.getID() }}, {{ lastComment.getTypeID() }}{{ categoryID is defined ? ', ' ~ categoryID }}{{ directorID is defined ? ', ' ~ directorID }})">Еще отзывы</button>
  23.         </div>
  24.         <div class="col-6 p-1">
  25.             {% if showAddCommentBtn %}
  26.                 <a class="btn btn-block text-dark bg-slivki" href="/ostavit-otziv/{{ lastComment.getTypeID() }}/{{ lastEntityID }}">Добавить отзыв</a>
  27.             {% endif %}
  28.         </div>
  29.     </div>
  30. {% endif %}
  31. {% macro recursiveComment(comment, isLiveComments, level) %}
  32.     {% include 'Slivki/mobile/comment/item.html.twig' %}
  33.     {% for child in comment.getChildren()|filter(child => not child.isHidden() and child.isConfirmedPhone()) %}
  34.         {{ level == 1 ? '<div class="child-comment">' }}
  35.         {{ _self.recursiveComment(child, isLiveComments, level + 1) }}
  36.         {{ level == 1 ? '</div>' }}
  37.     {% endfor %}
  38. {% endmacro %}