misuzu/views/mio/news/macros.twig

28 lines
1.3 KiB
Twig

{% macro news_preview(post) %}
<div class="container news__preview">
<a href="/news.php?p={{ post.post_id }}" class="container__title container__title--link">
{{ post.post_title }}
</a>
<div class="container__content news__preview__content">
<div class="news__preview__text">
{{ post.post_text|first_paragraph|parse_text('md')|raw }}
</div>
<div class="news__preview__info">
<time class="news__preview__date" datetime="{{ post.created_at|date('c') }}" title="{{ post.created_at|date('r') }}">
{{ post.created_at|time_diff }}
</time>
{% if post.user_id is not null %}
<a class="news__preview__user" href="/profile.php?u={{ post.user_id }}">
<div class="news__preview__user__name" style="{{ post.user_colour|html_colour }}">
{{ post.username }}
</div>
<div class="avatar news__preview__user__avatar" style="background-image:url('/profile.php?u={{ post.user_id }}&amp;m=avatar')"></div>
</a>
{% endif %}
</div>
</div>
</div>
{% endmacro %}