pyfedi/app/templates/post/_post_teaser_masonry.html

52 lines
3.7 KiB
HTML

{% set content_blocked = post.blocked_by_content_filter(content_filters) %}
{% if content_blocked and content_blocked == '-1' %}
{# do nothing - blocked by keyword filter #}
{% else %}
<div class="post_teaser{{ ' reported' if post.reports and current_user.is_authenticated and post.community.is_moderator() }}{{ ' blocked' if content_blocked }}"
{% if content_blocked %} title="{{ _('Filtered: ') }}{{ content_blocked }}"{% endif %}>
{% if post.image_id %}
{% if post_layout == 'masonry' or low_bandwidth %}
{% set thumbnail = post.image.thumbnail_url() %}
{% elif post_layout == 'masonry_wide' %}
{% set thumbnail = post.image.view_url() %}
{% endif %}
<div class="masonry_thumb" title="{{ post.title }}">
{% if post.type == POST_TYPE_LINK %}
{% if post.image.medium_url() %}
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="{{ _('View image') }}"><img src="{{ post.image.medium_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="lazy" width="{{ post.image.thumbnail_width }}" height="{{ post.image.thumbnail_height }}" /></a>
{% elif post.image.source_url %}
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="{{ _('View image') }}"><img src="{{ post.image.source_url }}"
alt="{{ post.title }}" loading="lazy" /></a>
{% else %}
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="{{ _('View image') }}"><img src="{{ post.url }}"
alt="{{ post.title }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" /></a>
{% endif %}
{% elif post.type == POST_TYPE_IMAGE %}
<a href="{{ post.image.view_url() }}" rel="nofollow ugc" target="_blank"><img src="{{ post.image.medium_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="lazy" width="{{ post.image.thumbnail_width }}" height="{{ post.image.thumbnail_height }}" /></a>
{% else %}
<a href="{{ url_for('activitypub.post_ap', post_id=post.id) }}"><img src="{{ post.image.thumbnail_url() }}"
alt="{{ post.image.alt_text if post.image.alt_text else '' }}" loading="lazy" /></a>
{% endif %}
</div>
<div class="masonry_info">
<p><a href="{{ url_for('activitypub.post_ap', post_id=post.id) }}" title="{{ post.title }}">{{ post.title|shorten(25) }}</a></p>
</div>
{% else %}
{% if post.url and (post.url.endswith('.jpg') or post.url.endswith('.webp') or post.url.endswith('.png') or post.url.endswith('.gif') or post.url.endswith('.avif') or post.url.endswith('.jpeg')) %}
<div class="masonry_thumb" title="{{ post.title }}">
<a href="{{ post.url }}" rel="nofollow ugc" target="_blank" aria-label="{{ _('See image') }}"><img src="{{ post.url }}"
alt="{{ post.title }}" loading="{{ 'lazy' if low_bandwidth else 'eager' }}" /></a>
</div>
<div class="masonry_info">
<p><a href="{{ url_for('activitypub.post_ap', post_id=post.id) }}" title="{{ post.title }}">{{ post.title|shorten(25) }}</a></p>
</div>
{% else %}
<div class="masonry_info_no_image">
<p><a href="{{ url_for('activitypub.post_ap', post_id=post.id) }}">{{ post.title }}</a></p>
</div>
{% endif %}
{% endif %}
</div>
{% endif %}