2022-09-13 13:14:49 +00:00
{% macro forum_category_listing ( forums , title , colour , id , icon ) %}
{% from _self import forum_category_entry %}
{% from 'macros.twig' import container_title %}
2023-08-28 01:17:34 +00:00
{% if forums .info is defined %}
{% set title = forums .info .name | default ( 'Forums' ) %}
{% set icon = forums .info .iconForDisplay | default ( 'fas fa-folder fa-fw' ) %}
{% set colour = forums .colour | default ( null ) %}
{% set id = forums .info .id is defined ? 'f' ~ forums .info .id : '' %}
{% set forums = forums .children %}
{% elseif forums .children is defined %}
{% set title = 'Forums' %}
{% set icon = 'fas fa-folder fa-fw' %}
{% set colour = null %}
{% set id = '' %}
{% set forums = forums .children %}
{% else %}
{% set title = title | default ( 'Forums' ) %}
{% set icon = icon | default ( 'fas fa-folder fa-fw' ) %}
{% set colour = colour | default ( null ) %}
{% set id = id | default ( '' ) %}
{% endif %}
2023-08-31 14:55:39 +00:00
<div class="container forum__categories" {% if id | length > 0 %} id=" {{ id }} " {% endif %}
{% if colour is not null %} style="--accent-colour: {{ colour }} " {% endif %} >
2023-08-28 01:17:34 +00:00
{{ container_title ( '<span class="' ~ icon ~ '"></span> ' ~ title ) }}
2022-09-13 13:14:49 +00:00
{% if forums | length > 0 %}
<div class="forum__categories__list">
{% for forum in forums %}
{{ forum_category_entry ( forum ) }}
{% endfor %}
</div>
{% else %}
<div class="forum__categories__empty">
This category is empty.
</div>
{% endif %}
</div>
{% endmacro %}
{% macro forum_header ( title , breadcrumbs , omit_last_breadcrumb , title_url , actions ) %}
<div class="container forum__header">
{% if breadcrumbs is iterable and breadcrumbs | length > 0 %}
<div class="forum__header__breadcrumbs">
2023-08-28 01:17:34 +00:00
<a href=" {{ url ( 'forum-index' ) }} " class="forum__header__breadcrumb">Forums</a>
{% for category in breadcrumbs | reverse %}
<div class="forum__header__breadcrumb__separator">
<i class="fas fa-chevron-right"></i>
</div>
{% if not ( omit_last_breadcrumb | default ( false ) and category == breadcrumbs | first ) %}
<a href=" {{ category .hasParent ? url ( 'forum-category' , { 'forum' : category .id } ) : url ( 'forum-category-root' , { 'forum' : 'f' ~ category .id } ) }} " class="forum__header__breadcrumb"> {{ category .name }} </a>
2022-09-13 13:14:49 +00:00
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if title | length > 0 %}
{% if title_url | length > 0 %}
<a class="forum__header__title" href=" {{ title_url }} ">
{{ title }}
</a>
{% else %}
<div class="forum__header__title forum__header__title--fill">
{{ title }}
</div>
{% endif %}
{% endif %}
{% if actions is iterable and actions | length > 0 %}
<div class="forum__header__actions">
{% for action in actions %}
{% if action .display is not defined or action .display %}
2024-12-18 03:07:48 +00:00
<a class=" {{ html_classes ( 'forum__header__action' , action .class | default ( '' ) ) }} " {% if action .method is defined %} href="javascript:;" data-method=" {{ action .method }} " data-url=" {{ action .url }} " {% if action .disableWith is defined %} data-disable-with=" {{ action .disableWith }} " {% endif %} {% if action .disableWithTarget is defined %} data-disable-with-target=" {{ action .disableWithTarget }} " {% endif %} {% if action .withCsrf | default ( false ) %} data-with-csrf="1" {% endif %} {% if action .refreshOnSuccess | default ( false ) %} data-refresh-on-success="1" {% endif %} {% if action .redirectOnSuccess is defined and action .redirectOnSuccess is not empty %} data-redirect-on-success=" {{ action .redirectOnSuccess }} " {% endif %} {% if action .confirm is defined %} data-confirm=" {{ action .confirm }} " {% endif %} {% else %} href=" {{ action .url }} " {% endif %} >
2022-09-13 13:14:49 +00:00
{{ action .html | raw }}
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% endmacro %}
{% macro forum_category_tools ( info , perms , pagination_info ) %}
{% from 'macros.twig' import pagination %}
2023-08-28 01:17:34 +00:00
{% if info .forum_id is defined %}
{% set forum_id = info .forum_id %}
{% set is_archived = info .forum_archived != 0 %}
{% else %}
{% set forum_id = info .id %}
2024-11-30 04:09:29 +00:00
{% set is_archived = info .archived %}
2023-08-28 01:17:34 +00:00
{% endif %}
{% set is_locked = is_archived %}
{% set can_topic = not is_locked and perms .can_create_topic %}
2023-09-08 20:40:48 +00:00
{% set pag = pagination ( pagination_info , 'forum-category' , { 'forum' : forum_id } ) %}
2022-09-13 13:14:49 +00:00
{% if can_topic or pag | trim | length > 0 %}
<div class="container forum__actions">
<div class="forum__actions__buttons">
{% if can_topic %}
2023-08-28 01:17:34 +00:00
<a href=" {{ url ( 'forum-topic-new' , { 'forum' : forum_id } ) }} " class="input__button forum__actions__button">New Topic</a>
2022-09-13 13:14:49 +00:00
{% endif %}
</div>
<div class="forum__actions__pagination">
{{ pag }}
</div>
</div>
{% endif %}
{% endmacro %}
{% macro forum_topic_tools ( info , pagination_info , can_reply ) %}
{% from 'macros.twig' import pagination %}
2023-09-08 20:40:48 +00:00
{% set pag = pagination ( pagination_info , 'forum-topic' , { 'topic' : info .id } ) %}
2022-09-13 13:14:49 +00:00
{% if can_reply or pag | trim | length > 0 %}
<div class="container forum__actions">
<div class="forum__actions__buttons">
{% if can_reply %}
2023-08-28 01:17:34 +00:00
<a href=" {{ url ( 'forum-reply-new' , { 'topic' : info .id } ) }} " class="input__button">Reply</a>
2022-09-13 13:14:49 +00:00
{% endif %}
</div>
<div class="forum__actions__pagination">
{{ pag }}
</div>
</div>
{% endif %}
{% endmacro %}
{% macro forum_category_entry ( forum , forum_unread , forum_icon ) %}
{% from 'macros.twig' import avatar %}
2023-08-28 01:17:34 +00:00
{% if forum .info is defined %}
{% set forum_id = forum .info .id %}
{% set forum_name = forum .info .name %}
{% set forum_desc = forum .info .description | default ( '' ) %}
{% set forum_is_link = forum .info .isLink %}
{% set forum_may_have_children = forum .info .mayHaveChildren %}
{% set forum_link_clicks = forum .info .linkClicks %}
{% set forum_count_topics = forum .info .topicsCount %}
{% set forum_count_posts = forum .info .postsCount %}
2024-11-30 04:09:29 +00:00
{% set forum_show_activity = forum .info .mayHaveTopics or forum .info .linkClicks is not null %}
2023-08-28 01:17:34 +00:00
{% set forum_unread = forum .unread %}
{% set forum_colour = forum .colour %}
{% set forum_has_recent_post = forum .lastPost is defined %}
{% set children = forum .children %}
{% if forum_has_recent_post %}
{% set forum_recent_post_id = forum .lastPost .info .id %}
{% set forum_recent_topic_title = forum .lastPost .topicInfo .title %}
{% set forum_recent_post_created = forum .lastPost .info .createdTime %}
{% set forum_has_recent_post_user = forum_has_recent_post and forum .lastPost .user is defined %}
{% if forum_has_recent_post_user %}
{% set forum_recent_post_user_id = forum .lastPost .user .id %}
{% set forum_recent_post_user_name = forum .lastPost .user .name %}
{% set forum_recent_post_user_colour = '--user-colour: ' ~ forum .lastPost .colour %}
2022-09-13 13:14:49 +00:00
{% endif %}
{% endif %}
2023-08-28 01:17:34 +00:00
{% if forum_icon is empty %}
{% set forum_icon = forum .info .iconForDisplay %}
{% endif %}
{% else %}
{% set forum_id = null %}
{% set forum_name = 'Forums' %}
{% set forum_desc = null %}
{% set forum_is_link = false %}
{% set forum_may_have_children = true %}
{% set forum_count_topics = 0 %}
{% set forum_count_posts = 0 %}
{% set forum_show_activity = false %}
{% set forum_unread = false %}
{% set forum_colour = null %}
{% set forum_has_recent_post = false %}
{% set children = forum %}
2022-09-13 13:14:49 +00:00
{% endif %}
2023-08-28 01:17:34 +00:00
<div class="forum__category" {% if forum_colour is not null %} style="--accent-colour: {{ forum_colour }} " {% endif %} >
<a href=" {{ url ( 'forum-category' , { 'forum' : forum_id } ) }} " class="forum__category__link"></a>
2022-09-13 13:14:49 +00:00
<div class="forum__category__container">
2023-08-28 01:17:34 +00:00
<div class="forum__category__icon forum__category__icon-- {{ forum_unread ? 'unread' : 'read' }} ">
2022-09-13 13:14:49 +00:00
<span class=" {{ forum_icon }} "></span>
</div>
<div class="forum__category__details">
<div class="forum__category__title">
2023-08-28 01:17:34 +00:00
{{ forum_name }}
2022-09-13 13:14:49 +00:00
</div>
2023-08-28 01:17:34 +00:00
{% if forum_desc is not null %}
<div class="forum__category__description">
{{ forum_desc | nl2br }}
</div>
{% endif %}
2022-09-13 13:14:49 +00:00
2023-08-28 01:17:34 +00:00
{% if children | length > 0 %}
2022-09-13 13:14:49 +00:00
<div class="forum__category__subforums">
2023-08-28 01:17:34 +00:00
{% for child in children %}
{% if child .info is defined %}
{% set child_id = child .info .id %}
{% set child_name = child .info .name %}
{% set child_unread = child .unread %}
{% else %}
{% set child_id = child .forum_id %}
{% set child_name = child .forum_name %}
{% set child_unread = child .forum_unread %}
{% endif %}
<a href=" {{ url ( 'forum-category' , { 'forum' : child_id } ) }} "
class="forum__category__subforum {% if child_unread %} forum__category__subforum--unread {% endif %} ">
{{ child_name }}
2022-09-13 13:14:49 +00:00
</a>
{% endfor %}
</div>
{% endif %}
</div>
2023-08-28 01:17:34 +00:00
{% if forum_is_link %}
{% if forum_link_clicks is not null %}
2022-09-13 13:14:49 +00:00
<div class="forum__category__stats">
2023-08-28 01:17:34 +00:00
<div class="forum__category__stat" title="Clicks"> {{ forum_link_clicks | number_format }} </div>
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
2023-08-28 01:17:34 +00:00
{% elseif forum_may_have_children %}
2022-09-13 13:14:49 +00:00
<div class="forum__category__stats">
2023-08-28 01:17:34 +00:00
<div class="forum__category__stat" title="Topics"> {{ forum_count_topics | number_format }} </div>
<div class="forum__category__stat" title="Posts"> {{ forum_count_posts | number_format }} </div>
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
2023-08-28 01:17:34 +00:00
{% if forum_show_activity %}
<div class="forum__category__activity {% if forum_link_clicks is not null %} forum__category__activity--empty {% endif %} ">
{% if not forum_is_link %}
{% if forum_has_recent_post %}
2022-09-13 13:14:49 +00:00
<div class="forum__category__activity__details">
<a class="forum__category__activity__post"
2023-08-28 01:17:34 +00:00
href=" {{ url ( 'forum-post' , { 'post' : forum_recent_post_id , 'post_fragment' : 'p' ~ forum_recent_post_id } ) }} ">
{{ forum_recent_topic_title }}
2022-09-13 13:14:49 +00:00
</a>
<div class="forum__category__activity__info">
2023-08-28 01:17:34 +00:00
{% if forum_has_recent_post_user %}
<a href=" {{ url ( 'user-profile' , { 'user' : forum_recent_post_user_id } ) }} " class="forum__category__username"
style=" {{ forum_recent_post_user_colour }} "> {{ forum_recent_post_user_name }} </a>
2022-09-13 13:14:49 +00:00
{% endif %}
2023-08-28 01:17:34 +00:00
<time datetime=" {{ forum_recent_post_created | date ( 'c' ) }} " title=" {{ forum_recent_post_created | date ( 'r' ) }} "> {{ forum_recent_post_created | time_format }} </time>
2022-09-13 13:14:49 +00:00
</div>
</div>
2023-08-28 01:17:34 +00:00
{% if forum_has_recent_post_user %}
<a href=" {{ url ( 'user-profile' , { 'user' : forum_recent_post_user_id } ) }} " class="avatar forum__category__avatar">
{{ avatar ( forum_recent_post_user_id , 4 0 , forum_recent_post_user_name ) }}
2022-09-13 13:14:49 +00:00
</a>
{% endif %}
2023-08-28 01:17:34 +00:00
{% else %}
<div class="forum__category__activity__none">
There are no posts in this forum yet.
</div>
2022-09-13 13:14:49 +00:00
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
</div>
{% endmacro %}
2023-04-30 00:18:14 +00:00
{% macro forum_topic_notice ( icon , body ) %}
<div class="container forum__status">
<div class="forum__status__icon">
<div class="forum__status__icon__background"></div>
<i class="fas fa- {{ icon }} "></i>
</div>
<div class="forum__status__text">
{{ body | raw }}
</div>
</div>
{% endmacro %}
{% macro forum_topic_redirect ( redirect ) %}
{% from _self import forum_topic_notice %}
{% if redirect is not empty %}
{% set body %}
2023-08-28 01:17:34 +00:00
This topic redirects to <span class="forum__status__emphasis"><a href=" {{ redirect .linkTarget }} " class="link"> {{ redirect .linkTarget }} </a></span>.
2023-04-30 00:18:14 +00:00
{% endset %}
{{ forum_topic_notice ( 'share' , body ) }}
{% endif %}
{% endmacro %}
2022-09-13 13:14:49 +00:00
{% macro forum_topic_locked ( locked , archived ) %}
2023-04-30 00:18:14 +00:00
{% from _self import forum_topic_notice %}
2022-09-13 13:14:49 +00:00
{% if locked is not null or archived %}
2023-04-30 00:18:14 +00:00
{% set body %}
{% if archived %}
This topic has been <span class="forum__status__emphasis">archived</span>.
{% else %}
This topic was locked
<time class="forum__status__emphasis"
datetime=" {{ locked | date ( 'c' ) }} "
2023-07-18 23:12:47 +00:00
title=" {{ locked | date ( 'r' ) }} "> {{ locked | time_format }} </time>.
2023-04-30 00:18:14 +00:00
{% endif %}
{% endset %}
{{ forum_topic_notice ( archived ? 'archive' : 'lock' , body ) }}
2022-09-13 13:14:49 +00:00
{% endif %}
{% endmacro %}
{% macro forum_topic_listing ( topics , title ) %}
{% from _self import forum_topic_entry %}
{% from 'macros.twig' import container_title %}
<div class="container forum__topics">
{{ container_title ( '<i class="fas fa-comments fa-fw"></i> ' ~ title | default ( 'Topics' ) ) }}
<div class="forum__topics__list">
{% if topics | length > 0 %}
{% for topic in topics %}
{{ forum_topic_entry ( topic ) }}
{% endfor %}
{% else %}
<div class="forum__topics__empty">
There are no topics in this forum.
</div>
{% endif %}
</div>
</div>
{% endmacro %}
{% macro forum_topic_entry ( topic , topic_icon , topic_unread ) %}
{% from 'macros.twig' import avatar %}
2023-08-28 01:17:34 +00:00
{% set topic_id = topic .info .id %}
{% set topic_title = topic .info .title %}
{% set topic_participated = topic .participated %}
{% set topic_count_posts = topic .info .postsCount %}
{% set topic_count_views = topic .info .viewsCount %}
{% set topic_created = topic .info .createdTime %}
2024-11-30 04:09:29 +00:00
{% set topic_locked = topic .info .locked %}
{% set topic_deleted = topic .info .deleted %}
2023-08-28 01:17:34 +00:00
{% set topic_pages = ( topic .info .postsCount / 1 0 ) | round ( 0 , 'ceil' ) %}
{% set has_topic_author = topic .user is defined %}
{% if has_topic_author %}
{% set topic_author_id = topic .user .id %}
{% set topic_author_name = topic .user .name %}
{% set topic_author_colour = '--user-colour: ' ~ topic .colour %}
{% endif %}
2023-09-10 19:13:36 +00:00
{% set has_reply = topic .lastPost is defined and topic .lastPost is not null %}
2023-08-28 01:17:34 +00:00
{% if has_reply %}
{% set reply_id = topic .lastPost .info .id %}
{% set reply_created = topic .lastPost .info .createdTime %}
{% set has_reply_author = topic .lastPost .user is defined %}
{% if has_reply_author %}
{% set reply_author_id = topic .lastPost .user .id %}
{% set reply_author_name = topic .lastPost .user .name %}
{% set reply_author_colour = '--user-colour: ' ~ topic .lastPost .colour %}
2022-09-13 13:14:49 +00:00
{% endif %}
{% endif %}
2023-08-28 01:17:34 +00:00
{% set topic_unread = topic .unread %}
{% set topic_important = topic .info .isImportant %}
{% if topic_icon is null %}
{% set topic_icon = topic .info .iconForDisplay ( topic .unread ) %}
{% endif %}
<div class="forum__topic {% if topic_deleted %} forum__topic--deleted {% elseif topic_locked and not topic_important %} forum__topic--locked {% endif %} ">
<a href=" {{ url ( 'forum-topic' , { 'topic' : topic_id } ) }} " class="forum__topic__link"></a>
2022-09-13 13:14:49 +00:00
<div class="forum__topic__container">
2023-01-01 05:01:18 +00:00
<div class="forum__topic__icon forum__topic__icon-- {{ topic_unread ? 'unread' : 'read' }} ">
<i class=" {{ topic_icon }} fa-fw"></i>
2022-09-13 13:14:49 +00:00
2023-08-28 01:17:34 +00:00
{% if topic_participated %}
2022-09-13 13:14:49 +00:00
<div class="forum__topic__icon__participated" title="You have posted in this topic"></div>
{% endif %}
</div>
<div class="forum__topic__details">
<div class="forum__topic__title">
<span class="forum__topic__title__inner">
2023-08-28 01:17:34 +00:00
{{ topic_title }}
2022-09-13 13:14:49 +00:00
</span>
</div>
<div class="forum__topic__info">
2023-08-28 01:17:34 +00:00
{% if has_topic_author %}
by <a href=" {{ url ( 'user-profile' , { 'user' : topic_author_id } ) }} " class="forum__topic__username" style=" {{ topic_author_colour }} "> {{ topic_author_name }} </a>,
2022-09-13 13:14:49 +00:00
{% endif %}
2023-08-28 01:17:34 +00:00
<time datetime=" {{ topic_created | date ( 'c' ) }} " title=" {{ topic_created | date ( 'r' ) }} "> {{ topic_created | time_format }} </time>
2022-09-13 13:14:49 +00:00
</div>
2023-08-28 01:17:34 +00:00
{% if topic_pages | default ( 0 ) > 1 %}
2022-09-13 13:14:49 +00:00
<div class="forum__topic__pagination">
2023-08-28 01:17:34 +00:00
{% set topic_pages_start_end = min ( 3 , topic_pages ) %}
2023-07-05 01:33:12 +00:00
{% for i in 1. .topic_pages_start_end %}
2023-08-28 01:17:34 +00:00
<a href=" {{ url ( 'forum-topic' , { 'topic' : topic_id , 'page' : i } ) }} " class="forum__topic__pagination__item">
2022-09-13 13:14:49 +00:00
{{ i }}
</a>
{% endfor %}
2023-08-28 01:17:34 +00:00
{% if topic_pages > 3 %}
{% if topic_pages > 6 %}
2022-09-13 13:14:49 +00:00
<div class="forum__topic__pagination__separator">
<i class="fas fa-ellipsis-h"></i>
</div>
{% endif %}
2023-08-28 01:17:34 +00:00
{% set topic_pages_end_start = max ( 4 , min ( topic_pages , topic_pages - 2 ) ) %}
{% for i in topic_pages_end_start .. topic_pages %}
<a href=" {{ url ( 'forum-topic' , { 'topic' : topic_id , 'page' : i } ) }} " class="forum__topic__pagination__item">
2022-09-13 13:14:49 +00:00
{{ i }}
</a>
{% endfor %}
{% endif %}
</div>
{% endif %}
</div>
<div class="forum__topic__stats">
2023-08-28 01:17:34 +00:00
<div class="forum__topic__stat" title="Posts"> {{ topic_count_posts | number_format }} </div>
<div class="forum__topic__stat" title="Views"> {{ topic_count_views | number_format }} </div>
2022-09-13 13:14:49 +00:00
</div>
<div class="forum__topic__activity">
<div class="forum__topic__activity__details">
2023-08-28 01:17:34 +00:00
{% if has_reply %}
{% if has_reply_author %}
<a href=" {{ url ( 'user-profile' , { 'user' : reply_author_id } ) }} " class="forum__topic__username" style=" {{ reply_author_colour }} "> {{ reply_author_name }} </a>
{% endif %}
<a class="forum__topic__activity__post" href=" {{ url ( 'forum-post' , { 'post' : reply_id , 'post_fragment' : 'p' ~ reply_id } ) }} ">
<time datetime=" {{ reply_created | date ( 'c' ) }} " title=" {{ reply_created | date ( 'r' ) }} "> {{ reply_created | time_format }} </time>
</a>
2022-09-13 13:14:49 +00:00
{% endif %}
</div>
2023-08-28 01:17:34 +00:00
{% if has_reply and has_reply_author %}
<a href=" {{ url ( 'user-profile' , { 'user' : reply_author_id } ) }} " class="forum__topic__avatar">
{{ avatar ( reply_author_id , 3 0 , reply_author_name ) }}
2022-09-13 13:14:49 +00:00
</a>
{% endif %}
</div>
</div>
</div>
{% endmacro %}
{% macro forum_post_listing ( posts , user_id , perms ) %}
{% from _self import forum_post_entry %}
{% for post in posts %}
{{ forum_post_entry ( post , user_id , perms ) }}
{% endfor %}
{% endmacro %}
{% macro forum_post_entry ( post , user_id , perms ) %}
{% from 'macros.twig' import avatar %}
2023-08-28 01:17:34 +00:00
{% set post_id = post .info .id %}
{% set post_created = post .info .createdTime %}
{% set post_edited = post .info .editedTime %}
2024-11-30 04:09:29 +00:00
{% set post_is_deleted = post .info .deleted %}
2023-08-28 01:17:34 +00:00
{% set post_is_op = post .isOriginalPost %}
{% set post_body = post .info .body | escape | parse_text ( post .info .parser ) %}
{% set post_is_markdown = post .info .isBodyMarkdown %}
{% set post_show_signature = post .info .shouldDisplaySignature %}
{% set post_can_be_deleted = post .info .canBeDeleted %}
{% set topic_id = post .info .topicId %}
{% set has_author = post .user is defined %}
{% if has_author %}
{% set author_id = post .user .id %}
{% set author_name = post .user .name %}
{% set author_title = post .user .title %}
2023-08-28 01:32:05 +00:00
{% set author_colour = '--accent-colour:' ~ post .colour %}
2023-08-28 01:17:34 +00:00
{% set author_country = post .user .countryCode %}
{% set author_created = post .user .createdTime %}
{% set author_posts_count = post .postsCount %}
{% set author_is_op = post .isOriginalPoster %}
2024-11-30 04:09:29 +00:00
{% set signature_body = post .user .signatureBody | default ( '' ) | escape | parse_text ( post .user .signatureBodyParser ) %}
2023-08-28 01:17:34 +00:00
{% set signature_is_markdown = post .user .isSignatureBodyMarkdown %}
{% endif %}
{% set viewer_is_author = has_author and user_id == author_id %}
{% set can_edit = perms .can_edit_any_post | default ( false ) or ( viewer_is_author and perms .can_edit_post | default ( false ) ) %}
{% set can_delete = not post_is_op and ( perms .can_delete_any_post | default ( false ) or ( viewer_is_author and perms .can_delete_post | default ( false ) and post_can_be_deleted ) ) %}
<div class="container forum__post {% if post_is_deleted %} forum__post--deleted {% endif %} " id="p {{ post_id }} " {% if author_colour is defined %} style=" {{ author_colour }} " {% endif %} >
2022-09-13 13:14:49 +00:00
<div class="forum__post__info">
<div class="forum__post__info__background"></div>
<div class="forum__post__info__content">
2023-08-28 01:17:34 +00:00
{% if has_author %}
<a class="forum__post__avatar" href=" {{ url ( 'user-profile' , { 'user' : author_id } ) }} ">
{{ avatar ( author_id , 1 2 0 , author_name ) }}
2022-09-13 13:14:49 +00:00
</a>
2023-08-28 01:17:34 +00:00
<a class="forum__post__username" href=" {{ url ( 'user-profile' , { 'user' : author_id } ) }} "> {{ author_name }} </a>
2022-09-13 13:14:49 +00:00
2023-08-28 01:17:34 +00:00
{% if author_title | length > 0 %}
<div class="forum__post__usertitle"> {{ author_title }} </div>
2022-09-13 13:14:49 +00:00
{% endif %}
<div class="forum__post__icons">
2023-08-28 01:17:34 +00:00
<div class="flag flag-- {{ author_country | lower }} " title=" {{ author_country | country_name }} "></div>
{% if author_posts_count is not null %} <div class="forum__post__posts-count"> {{ author_posts_count | number_format }} posts</div> {% endif %}
2022-09-13 13:14:49 +00:00
</div>
2023-08-28 01:17:34 +00:00
{% if author_is_op %}
2022-09-13 13:14:49 +00:00
<div class="forum__post__badge forum__post__badge--original-poster">
<div class="forum__post__badge__desktop">Original Poster</div>
<div class="forum__post__badge__mobile">OP</div>
</div>
{% endif %}
<div class="forum__post__joined">
2023-08-28 01:17:34 +00:00
joined <time datetime=" {{ author_created | date ( 'c' ) }} " title=" {{ author_created | date ( 'r' ) }} "> {{ author_created | time_format }} </time>
2022-09-13 13:14:49 +00:00
</div>
{% else %}
<div class="forum__post__username">Deleted User</div>
{% endif %}
</div>
</div>
<div class="forum__post__content">
2023-08-28 01:17:34 +00:00
{% set post_link = url ( post_is_op ? 'forum-topic' : 'forum-post' , { 'topic' : topic_id , 'post' : post_id , 'post_fragment' : 'p%d' | format ( post_id ) } ) %}
2022-09-13 13:14:49 +00:00
<div class="forum__post__details">
<a class="forum__post__datetime" href=" {{ post_link }} ">
2023-08-28 01:17:34 +00:00
<time datetime=" {{ post_created | date ( 'c' ) }} " title=" {{ post_created | date ( 'r' ) }} "> {{ post_created | time_format }} </time>
{% if post_edited is not null %}
(edited <time datetime=" {{ post_edited | date ( 'c' ) }} " title=" {{ post_edited | date ( 'r' ) }} "> {{ post_edited | time_format }} </time>)
2022-09-13 13:14:49 +00:00
{% endif %}
</a>
<a class="forum__post__id" href=" {{ post_link }} ">
2023-08-28 01:17:34 +00:00
# {{ post_id }}
2022-09-13 13:14:49 +00:00
</a>
</div>
2023-08-28 01:17:34 +00:00
<div class="forum__post__text {% if post_is_markdown %} markdown {% endif %} ">
{{ post_body | raw }}
2022-09-13 13:14:49 +00:00
</div>
2023-08-28 01:17:34 +00:00
{% if perms .can_create_post | default ( false ) or can_edit or can_delete %}
2022-09-13 13:14:49 +00:00
<div class="forum__post__actions">
2023-08-28 01:17:34 +00:00
{% if post_is_deleted %}
2024-12-18 03:07:48 +00:00
<button class="forum__post__action forum__post__action--restore" data-method="POST" data-url=" {{ url ( 'forum-post-restore' , { 'post' : post_id } ) }} " data-refresh-on-success="1" data-with-csrf="1" data-disable-with="Restoring..." data-disable-with-target=".js-action-text" data-confirm="Are you sure you want to restore this post?"><i class="fas fa-magic fa-fw"></i> <span class="js-action-text">Restore</span></button>
<button class="forum__post__action forum__post__action--nuke" data-method="POST" data-url=" {{ url ( 'forum-post-nuke' , { 'post' : post_id } ) }} " data-redirect-on-success=" {{ url ( 'forum-topic' , { topic : post .info .topicId } ) }} " data-with-csrf="1" data-disable-with="Nuking..." data-disable-with-target=".js-action-text" data-confirm="Are you sure you want to PERMANENTLY DELETE this post?"><i class="fas fa-radiation-alt fa-fw"></i> <span class="js-action-text">Permanently Delete</span></button>
2022-09-13 13:14:49 +00:00
{% else %}
2023-08-28 01:17:34 +00:00
{ # if perms.can_create_post|default(false) %}
<a href=" {{ url ( 'forum-post-quote' , { 'post' : post_id } ) }} " class="forum__post__action forum__post__action--quote"><i class="fas fa-quote-left fa-fw"></i> Quote</a>
2022-09-13 13:14:49 +00:00
{% endif # }
{% if can_edit %}
2023-08-28 01:17:34 +00:00
<a href=" {{ url ( 'forum-post-edit' , { 'post' : post_id } ) }} " class="forum__post__action forum__post__action--edit"><i class="fas fa-edit fa-fw"></i> Edit</a>
2022-09-13 13:14:49 +00:00
{% endif %}
{% if can_delete %}
2024-12-18 03:07:48 +00:00
<button class="forum__post__action forum__post__action--delete" data-method="DELETE" data-url=" {{ url ( 'forum-post-delete' , { 'post' : post_id } ) }} " data-redirect-on-success=" {{ perms .can_delete_any_post ? url ( 'forum-post' , { post : post .info .id } ) : url ( 'forum-topic' , { topic : post .info .topicId } ) }} " data-with-csrf="1" data-disable-with="Deleting..." data-disable-with-target=".js-action-text" data-confirm="Are you sure you want to delete this post?"><i class="fas fa-trash-alt fa-fw"></i> <span class="js-action-text">Delete</span></button>
2022-09-13 13:14:49 +00:00
{% endif %}
{% endif %}
</div>
{% endif %}
2023-08-28 01:17:34 +00:00
{% if post_show_signature and signature_body is defined and signature_body | length > 0 %}
<div class="forum__post__signature {% if signature_is_markdown %} markdown {% endif %} ">
{{ signature_body | raw }}
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
</div>
</div>
{% endmacro %}