Files
comment/templates/comments_tree_sub.tpl

114 lines
6.1 KiB
Smarty
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{foreach from=$subcomments item=c}
{* Контейнер комментария: Используем .card для блока, и ms-4 для вложенности *}
<div class="card mb-3 mod_comment_comment{if $c.parent_id} ms-4{/if}">
{* Подсветка (Highlight) *}
{if isset($smarty.request.subaction) && $smarty.request.subaction=='showonly' && isset($smarty.request.comment_id) && $smarty.request.comment_id==$c.Id}
<div class="border border-warning border-3 rounded p-0">
{/if}
<div id="{$c.Id}" class="mod_comment_box">
{* ===================================================================== *}
{* ТЕЛО КОММЕНТАРИЯ (Включает Аватар, Автор, Метаданные и Текст) *}
{* ===================================================================== *}
<div class="card-body p-3 d-flex align-items-start">
{* ----- БЛОК АВАТАРА (ИСПРАВЛЕНО) ----- *}
{$avatar_url = "{$ABS_PATH}modules/comment/img/no_avatar.webp"}
{if isset($c.avatar) && $c.avatar != ''}
{$avatar_url = $c.avatar}
{/if}
<div class="mod_comment_avatar flex-shrink-0 me-3">
<img src="{$avatar_url}" alt="Аватар пользователя {$c.comment_author_name|stripslashes|escape}" class="rounded-circle" style="width: 48px; height: 48px;" loading="lazy" />
</div>
{* -------------------------- *}
<div class="flex-grow-1">
{* Информация об авторе и дате (Сохраняем полную информацию) *}
<div class="mod_comment_meta mb-2 text-muted small">
{* Автор *}
<i class="fa fa-user me-1"></i> {#COMMENT_USER_ADD#} <a title="{#COMMENT_INFO#}" href="javascript:void(0);" onclick="popup('{$ABS_PATH}index.php?module=comment&action=postinfo&pop=1&Id={$c.Id}&theme={$theme}','comment','500','300','1');" class="fw-bold link-dark">{$c.comment_author_name|stripslashes|escape}</a>
{* Дата публикации *}
<span class="ms-2"><i class="fa fa-clock-o me-1"></i> {$c.comment_published}</span>
{* IP-адрес (для Админа) *}
{if $smarty.const.UGROUP==1}
<span class="ms-2 text-secondary">• IP:{$c.comment_author_ip}</span>
{/if}
{* Метка "Изменено" *}
<span class="mod_comment_changed">{if isset($c.comment_changed) && $c.comment_changed > 1} (<span class="text-secondary">{#COMMENT_TEXT_CHANGED#} {$c.comment_changed}</span>){/if}</span>
</div>
{* Текст комментария *}
<div class="mod_comment_text{if $smarty.const.UGROUP==1 || $c.comment_author_id==$smarty.session.user_id|default:'*'} editable_text{/if}">{$c.comment_text|escape}</div>
</div>
</div>
{* --------------------------------------------------------------------- *}
{* ===================================================================== *}
{* ПАНЕЛЬ ДЕЙСТВИЙ (card-footer) *}
{* ===================================================================== *}
<div class="card-footer mod_comment_actions d-flex justify-content-end align-items-center bg-white border-top p-2">
{* Ссылка "Ответить" (fa-reply) *}
{if $c.comment_author_id!=$smarty.session.user_id|default:'*' && (($cancomment==1 && $closed!=1) || $smarty.const.UGROUP==1)}
<a class="mod_comment_answer p-2 text-primary" href="javascript:void(0);" rel="{$c.Id}" title="{#COMMENT_ANSWER_LINK#}">
<i class="fa fa-reply me-1"></i> {#COMMENT_ANSWER_LINK#}
</a>
{/if}
{* ИКОНКА РЕДАКТИРОВАНИЯ (fa-pencil) *}
{if $smarty.const.UGROUP==1 || $c.comment_author_id==$smarty.session.user_id|default:'*'}
<a class="mod_comment_edit p-2 text-secondary" href="javascript:void(0);" title="{#COMMENT_EDIT_LINK#}">
<i class="fa fa-pencil me-1"></i> Редактировать
</a>
{/if}
{if $smarty.const.UGROUP==1}
{* Замок (Разблокировать/Заблокировать) *}
{if $c.comment_status!=1}
<a class="mod_comment_unlock p-2 text-success" href="javascript:void(0);" title="{#COMMENT_UNLOCK_LINK#}">
<i class="fa fa-unlock me-1"></i>
</a>
{else}
<a class="mod_comment_lock p-2 text-dark" href="javascript:void(0);" title="{#COMMENT_LOCK_LINK#}">
<i class="fa fa-lock me-1"></i>
</a>
{/if}
{* Корзина (Удалить) *}
<a class="mod_comment_delete p-2 text-danger" href="javascript:void(0);" title="{#COMMENT_DELETE_LINK#}">
<i class="fa fa-trash-o me-1"></i>
</a>
{/if}
</div>
{* --------------------------------------------------------------------- *}
</div>
{* Закрываем подсветку *}
{if isset($smarty.request.subaction) && $smarty.request.subaction=='showonly' && isset($smarty.request.comment_id) && $smarty.request.comment_id==$c.Id}
</div>
{/if}
{* Точка вставки формы ответа *}
<span id="end{$c.Id}"></span>
{* Рекурсивный вызов дочерних комментариев *}
{if isset($comments) && isset($comments[$c.Id])}
<div class="mt-3">
{include file="$subtpl" subcomments=$comments[$c.Id] sub=1}
</div>
{/if}
</div> {* Закрывает mod_comment_comment *}
{/foreach}