Files
comment/templates/comments_tree_sub.tpl

166 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}" data-user-rating="{$c.user_rating|default:0}" data-is-own="{if isset($c.is_my_own) && $c.is_my_own}1{else}0{/if}">
{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>
{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="d-flex align-items-center flex-wrap">
{* 1. Оценка автора (звезды) *}
{if isset($c.user_rating) && $c.user_rating > 0}
<div class="badge bg-warning text-dark me-3 d-inline-flex align-items-center" title="Оценка автора: {$c.user_rating} из 5" style="font-size: 0.75rem; padding: 0.4rem 0.6rem; gap: 4px;">
<span style="line-height: 1;">Оценка автора:</span>
<div class="d-flex align-items-center" style="line-height: 1;">
{section name=r_star start=1 loop=6}
{if $smarty.section.r_star.index <= $c.user_rating}
<i class="bi bi-star-fill" style="font-size: 0.7rem;"></i>
{else}
<i class="bi bi-star text-white" style="font-size: 0.7rem;"></i>
{/if}
{/section}
</div>
<span class="fw-bold" style="line-height: 1;">{$c.user_rating}</span>
</div>
{/if}
{* 2. Общий рейтинг комментария *}
{if $comment_rating_type != 2}
<div class="comment-rating-container d-inline-flex align-items-center me-3 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}
<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="Оценить"></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}
{* 3. ТАЙМЕР РЕДАКТИРОВАНИЯ (Добавлена проверка на UGROUP != 1) *}
{if $smarty.const.UGROUP != 1 && $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 d-flex align-items-center">
{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}">
<i class="bi bi-reply-fill me-1"></i> {#COMMENT_ANSWER_LINK#}
</a>
{/if}
{/if}
{if $c.can_edit}
<span id="controls_{$c.Id}" class="d-flex">
<a class="p-2 text-warning text-decoration-none mod_comment_edit" href="javascript:void(0);" data-id="{$c.Id}">
<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}">
<i class="bi bi-trash me-1"></i> Удалить
</a>
</span>
{/if}
{if $smarty.const.UGROUP==1}
<a class="mod_comment_{if $c.comment_status!=1}unlock{else}lock{/if} p-2 text-dark" href="javascript:void(0);" data-id="{$c.Id}">
<i class="bi bi-{if $c.comment_status!=1}unlock-fill{else}lock-fill{/if}"></i>
</a>
{/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}