openvk/Web/Presenters/templates/components/post/microblogpost.xml

133 lines
7 KiB
XML
Raw Normal View History

2021-01-27 20:40:37 +03:00
{var author = $post->getOwner()}
2021-11-28 14:39:42 +03:00
{var comments = $post->getLastComments(3)}
{var commentsCount = $post->getCommentsCount()}
{var commentTextAreaId = $post === null ? rand(1,300) : $post->getId()}
2021-01-27 20:40:37 +03:00
<table border="0" style="font-size: 11px;" n:class="post, !$compact ? post-divider, $post->isExplicit() ? post-nsfw">
<tbody>
<tr>
<td width="54" valign="top">
<img
src="{$author->getAvatarURL()}"
width="{ifset $compact}25{else}50{/ifset}" />
2021-11-04 14:45:30 +03:00
{if !$post->isPostedOnBehalfOfGroup() && !$compact}
<span n:if="$author->isOnline()" class="post-online">
{_online}
</span>
{/if}
2021-01-27 20:40:37 +03:00
</td>
<td width="100%" valign="top">
<div class="post-author">
<a href="{$author->getURL()}">
<b>
{$author->getCanonicalName()}
</b>
</a>
{if $author->isVerified()}<img class="name-checkmark" src="/assets/packages/static/openvk/img/checkmark.png">{/if}
{if ($onWallOf ?? false) &&!$post->isPostedOnBehalfOfGroup() && $post->getOwnerPost() !== $post->getTargetWall()}
{var wallId = $post->getTargetWall()}
{var wallURL = $wallId > -1 ? "/id$wallId" : "/club" . abs($wallId)}
на
<a href="{$wallURL}">
<b>
{if isset($thisUser) && $thisUser->getId() === $wallId}
вашей
{/if}
стене
{if $wallId < 0}
группы
{/if}
</b>
</a>
{/if}
2021-01-27 20:40:37 +03:00
{ifset $compact}<br>
2021-09-20 15:19:15 +03:00
<a href="/wall{$post->getPrettyId()}" class="date">
{$post->getPublicationTime()}
2021-09-20 15:19:15 +03:00
</a>
2021-01-27 20:40:37 +03:00
{/ifset}
{if $post->isPinned()}
<span class="nobold">{_pinned}</span>
{/if}
2021-01-27 20:40:37 +03:00
{if $post->canBeDeletedBy($thisUser) && !($forceNoDeleteLink ?? false) && !isset($compact)}
<a class="delete" href="/wall{$post->getPrettyId()}/delete"></a>
{/if}
{if $post->canBePinnedBy($thisUser) && !($forceNoPinLink ?? false) && !isset($compact)}
2021-09-20 15:19:15 +03:00
{if $post->isPinned()}
<a class="pin" href="/wall{$post->getPrettyId()}/pin?act=unpin&hash={rawurlencode($csrfToken)}"></a>
2021-09-20 15:19:15 +03:00
{else}
<a class="pin" href="/wall{$post->getPrettyId()}/pin?act=pin&hash={rawurlencode($csrfToken)}"></a>
2021-09-20 15:19:15 +03:00
{/if}
2021-01-27 20:40:37 +03:00
{/if}
</div>
<div class="post-content" id="{$post->getPrettyId()}">
<div class="text" id="text{$post->getPrettyId()}">
{$post->getText()|noescape}
<div n:ifcontent class="attachments_b">
<div class="attachment" n:foreach="$post->getChildren() as $attachment" data-localized-nsfw-text="{_nsfw_warning}">
{include "../attachment.xml", attachment => $attachment}
</div>
</div>
</div>
<div n:if="$post->isAd()" style="color:grey;">
<br/>
&nbsp;! Этот пост был размещён за взятку.
</div>
<div n:if="$post->isSigned()" class="post-signature">
{var acutalAuthor = $post->getOwner(false)}
<span>
Автор:
<a href="{$acutalAuthor->getURL()}">
{$acutalAuthor->getCanonicalName()}
</a>
</span>
</div>
</div>
<div class="post-menu" n:if="!isset($compact)">
<a href="/wall{$post->getPrettyId()}" class="date">{$post->getPublicationTime()}</a>
{if isset($thisUser)}
&nbsp;
{if !($forceNoCommentsLink ?? false)}
2021-11-28 14:39:42 +03:00
<a n:if="$commentsCount == 0" href="javascript:expand_comment_textarea({$commentTextAreaId})">
{_"comment"}
2021-01-27 20:40:37 +03:00
</a>
{/if}
<div class="like_wrap">
2021-11-27 16:31:00 +03:00
<a class="post-share-button" href="javascript:repostPost('{$post->getPrettyId()}', '{rawurlencode($csrfToken)}')">
2021-01-27 20:40:37 +03:00
<div class="repost-icon" style="opacity: 0.4;"></div>
2021-11-27 16:31:00 +03:00
<span class="likeCnt">{if $post->getRepostCount() > 0}{$post->getRepostCount()}{/if}</span>
2021-01-27 20:40:37 +03:00
</a>
{var liked = $post->hasLikeFrom($thisUser)}
<a href="/wall{$post->getPrettyId()}/like?hash={rawurlencode($csrfToken)}"
class="post-like-button"
data-liked="{(int) $liked}"
data-likes="{$post->getLikesCount()}">
2021-11-27 16:31:00 +03:00
<div class="heart" id="{if $liked}liked{/if}"></div>
<span class="likeCnt">{if $post->getLikesCount() > 0}{$post->getLikesCount()}{/if}</span>
2021-01-27 20:40:37 +03:00
</a>
</div>
{/if}
</div>
2021-11-28 14:39:42 +03:00
<div n:if="$commentSection == true && $compact == false" class="post-menu-s">
{if $commentsCount > 3}
2021-11-28 14:56:39 +03:00
<a href="/wall{$post->getPrettyId()}" class="expand_button">{_view_other_comments}</a>
2021-11-28 14:39:42 +03:00
{/if}
{foreach $comments as $comment}
{include "../comment.xml", comment => $comment, $compact => true}
{/foreach}
<div n:ifset="$thisUser" id="commentTextArea{$commentTextAreaId}" n:attr="style => ($commentsCount == 0 ? 'display: none;')" class="commentsTextFieldWrap">
{var commentsURL = "/al_comments.pl/create/posts/" . $post->getId()}
{include "../textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), post => $post}
</div>
2021-01-27 20:40:37 +03:00
</div>
</td>
</tr>
</tbody>
</table>