Files
comment/templates/comments_tree_sub.tpl

176 lines
10 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}
<div class="card mb-3 mod_comment_comment{if $c.parent_id} ms-4{/if}" id="comment_wrapper_{$c.Id}">
{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="comment_{$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 d-flex align-items-center flex-wrap">
<span class="me-2"><i class="bi bi-person 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>
<span class="me-2"><i class="bi bi-clock me-1"></i> {$c.comment_published}</span>
{* ----- БЛОК РЕЙТИНГА (ЗВЕЗДЫ ИЛИ ЛАЙКИ) ----- *}
{* Добавлена проверка на полное отключение (значение 2) *}
{if $comment_rating_type != 2}
<div class="comment-rating-container d-inline-flex align-items-center ms-2 py-1 px-2 bg-light rounded border" data-id="{$c.Id}" style="line-height: 1;">
{if $comment_rating_type == 1}
{* РЕЖИМ ЛАЙКОВ (СЕРДЕЧКО) *}
<div class="comment-like d-inline-flex align-items-center" style="cursor: pointer; color: #dc3545; font-size: 0.95rem;">
<i class="star-item bi bi-heart-fill me-1"
data-value="5"
title="Мне нравится"></i>
</div>
{if isset($c.rating_count)}
<span class="ms-1 text-muted fw-bold" style="font-size: 0.8rem;">{$c.rating_count}</span>
{/if}
{else}
{* РЕЖИМ ЗВЕЗД (1-5) - ПО УМОЛЧАНИЮ ПРИ 0 *}
<div class="comment-stars d-inline-flex" style="cursor: pointer; color: #ffc107; font-size: 0.9rem;">
{assign var="avg_rating" value=0}
{if isset($c.rating_count) && $c.rating_count > 0}
{math equation="round(x / y)" x=$c.rating_sum y=$c.rating_count assign="avg_rating"}
{/if}
{section name=star start=1 loop=6}
<i class="star-item bi {if $smarty.section.star.index <= $avg_rating}bi-star-fill{else}bi-star{/if} {if !$smarty.section.star.last}me-1{/if}"
data-value="{$smarty.section.star.index}"
title="Оценить на {$smarty.section.star.index}"></i>
{/section}
</div>
{if isset($c.rating_count)}
<span class="ms-2 text-muted fw-bold" style="font-size: 0.8rem;">({$c.rating_count})</span>
{/if}
{/if}
</div>
{/if}
{* --------------------------------- *}
{if $comment_show_f1 == 1 && $c.comment_author_website}
<span class="ms-2 d-inline-block">
<i class="bi bi-link-45deg"></i> <strong>{$comment_name_f1|default:#COMMENT_YOUR_SITE#}:</strong> {$c.comment_author_website|stripslashes|escape}
</span>
{/if}
{if $comment_show_f2 == 1 && $c.comment_author_city}
<span class="ms-2 d-inline-block">
<i class="bi bi-geo-alt"></i> <strong>{$comment_name_f2|default:#COMMENT_YOUR_FROM#}:</strong> {$c.comment_author_city|stripslashes|escape}
</span>
{/if}
{if $smarty.const.UGROUP==1}
<span class="ms-2 text-secondary">• IP:{$c.comment_author_ip}</span>
{/if}
<span class="mod_comment_changed ms-2" id="changed_{$c.Id}">
{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 comment-text-content">{$c.comment_text|stripslashes|nl2br}</div>
{* ВЫВОД ПРИКРЕПЛЕННОГО ИЗОБРАЖЕНИЯ *}
{if !empty($c.comment_file)}
<div class="mod_comment_attached_image mt-3" id="image_container_{$c.Id}">
<a href="{$ABS_PATH}uploads/comments/{$c.comment_file}" target="_blank" class="comment-img-link">
<img src="{$ABS_PATH}uploads/comments/{$c.comment_file}"
class="img-fluid rounded border shadow-sm"
style="max-width: 300px; max-height: 400px; cursor: zoom-in;"
alt="Изображение к комментарию" />
</a>
</div>
{/if}
</div>
</div>
<div class="card-footer mod_comment_actions d-flex justify-content-between align-items-center bg-white border-top p-2">
{* ЛЕВАЯ ЧАСТЬ: Таймер (если доступно редактирование) *}
<div class="edit-timer-zone px-2">
{if $c.can_edit && isset($c.edit_time_left) && $c.edit_time_left > 0}
<div class="edit-timer-wrapper text-muted small" id="timer_container_{$c.Id}" title="Время на редактирование">
<i class="bi bi-hourglass-split text-primary"></i>
<span class="timer-count fw-bold" data-left="{$c.edit_time_left}" id="timer_{$c.Id}">
{math equation="floor(x/60)" x=$c.edit_time_left}:{if ($c.edit_time_left%60) < 10}0{/if}{math equation="x%60" x=$c.edit_time_left}
</span>
</div>
{/if}
</div>
{* ПРАВАЯ ЧАСТЬ: Кнопки действий *}
<div class="actions-buttons">
{* Кнопка ответа *}
{if ($cancomment==1 && $closed!=1) || $smarty.const.UGROUP==1}
{if !(isset($c.is_my_own) && $c.is_my_own)}
<a class="mod_comment_answer p-2 text-primary text-decoration-none" href="javascript:void(0);" data-id="{$c.Id}" title="{#COMMENT_ANSWER_LINK#}">
<i class="bi bi-reply-fill me-1"></i> {#COMMENT_ANSWER_LINK#}
</a>
{/if}
{/if}
{* ПРАВА НА РЕДАКТИРОВАНИЕ *}
{if $c.can_edit}
<span id="controls_{$c.Id}">
<a class="p-2 text-warning text-decoration-none mod_comment_edit" href="javascript:void(0);" data-id="{$c.Id}" title="{#COMMENT_EDIT_LINK#}">
<i class="bi bi-pencil-square me-1"></i> Редактировать
</a>
<a class="p-2 text-danger text-decoration-none mod_comment_delete" href="javascript:void(0);" data-id="{$c.Id}" title="{#COMMENT_DELETE_LINK#}">
<i class="bi bi-trash me-1"></i> Удалить
</a>
</span>
{/if}
{* УПРАВЛЕНИЕ СТАТУСОМ (ТОЛЬКО ДЛЯ АДМИНА) *}
{if $smarty.const.UGROUP==1}
{if $c.comment_status!=1}
<a class="mod_comment_unlock p-2 text-success" href="javascript:void(0);" data-id="{$c.Id}" title="{#COMMENT_UNLOCK_LINK#}">
<i class="bi bi-unlock-fill me-1"></i>
</a>
{else}
<a class="mod_comment_lock p-2 text-dark" href="javascript:void(0);" data-id="{$c.Id}" title="{#COMMENT_LOCK_LINK#}">
<i class="bi bi-lock-fill me-1"></i>
</a>
{/if}
{/if}
</div>
</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>
{/foreach}