2018-12-31 02:22:13 +00:00
|
|
|
{% macro forum_category_listing(forums, title, colour, id) %}
|
2018-05-18 01:20:27 +00:00
|
|
|
{% from _self import forum_category_entry %}
|
2018-10-22 19:53:21 +00:00
|
|
|
{% from 'macros.twig' import container_title %}
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-12-31 02:22:13 +00:00
|
|
|
<div class="container forum__categories"
|
|
|
|
{% if colour is not null %}style="{{ colour|html_colour('--accent-colour') }}"{% endif %}
|
|
|
|
{% if id|length > 0 %}id="{{ id }}"{% endif %}>
|
2018-12-27 02:59:57 +00:00
|
|
|
{{ container_title('<i class="fas fa-folder fa-fw"></i> ' ~ title) }}
|
2018-09-25 22:11:20 +00:00
|
|
|
|
|
|
|
{% if forums|length > 0 %}
|
|
|
|
<div class="forum__categories__list">
|
2018-05-18 01:20:27 +00:00
|
|
|
{% for forum in forums %}
|
|
|
|
{{ forum_category_entry(forum) }}
|
|
|
|
{% endfor %}
|
2018-09-25 22:11:20 +00:00
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="forum__categories__empty">
|
|
|
|
This category is empty.
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-05-18 01:20:27 +00:00
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2019-01-11 23:00:53 +00:00
|
|
|
{% macro forum_header(title, breadcrumbs, omit_last_breadcrumb, title_url, actions) %}
|
2018-10-22 17:26:59 +00:00
|
|
|
<div class="container forum__header">
|
2018-10-15 23:00:17 +00:00
|
|
|
{% if breadcrumbs is iterable and breadcrumbs|length > 0 %}
|
|
|
|
<div class="forum__header__breadcrumbs">
|
|
|
|
{% for name, url in breadcrumbs %}
|
|
|
|
{% if url != breadcrumbs|first %}
|
|
|
|
<div class="forum__header__breadcrumb__separator">
|
|
|
|
<i class="fas fa-chevron-right"></i>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if not (omit_last_breadcrumb|default(false) and url == breadcrumbs|last) %}
|
|
|
|
<a href="{{ url }}" class="forum__header__breadcrumb">{{ name }}</a>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if title|length > 0 %}
|
2018-12-30 03:07:42 +00:00
|
|
|
{% if title_url|length > 0 %}
|
|
|
|
<a class="forum__header__title" href="{{ title_url }}">
|
|
|
|
{{ title }}
|
|
|
|
</a>
|
|
|
|
{% else %}
|
2019-02-12 14:04:05 +00:00
|
|
|
<div class="forum__header__title forum__header__title--fill">
|
2018-12-30 03:07:42 +00:00
|
|
|
{{ title }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-10-15 23:00:17 +00:00
|
|
|
{% endif %}
|
2019-01-11 23:00:53 +00:00
|
|
|
|
|
|
|
{% 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 %}
|
|
|
|
<a class="forum__header__action{% if action.class is defined %}{{ action.class }}{% endif %}" href="{{ action.url }}">
|
|
|
|
{{ action.html|raw }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-10-15 23:00:17 +00:00
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2019-01-12 18:22:13 +00:00
|
|
|
{% macro forum_category_tools(info, perms, pagination_info) %}
|
2018-10-25 00:15:23 +00:00
|
|
|
{% from 'macros.twig' import pagination %}
|
|
|
|
|
2019-01-02 22:16:50 +00:00
|
|
|
{% set is_locked = info.forum_archived != 0 %}
|
2019-01-02 21:56:21 +00:00
|
|
|
{% set can_topic = not is_locked and perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_TOPIC')) %}
|
2019-02-28 21:52:39 +00:00
|
|
|
{% set pag = pagination(pagination_info, url('forum-category'), null, {'f': info.forum_id}) %}
|
2018-12-28 05:03:42 +00:00
|
|
|
|
2019-01-12 18:22:13 +00:00
|
|
|
{% if can_topic or pag|trim|length > 0 %}
|
2018-12-28 05:03:42 +00:00
|
|
|
<div class="container forum__actions">
|
|
|
|
<div class="forum__actions__buttons">
|
|
|
|
{% if can_topic %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-topic-new', {'forum': info.forum_id}) }}" class="input__button forum__actions__button">New Topic</a>
|
2019-01-09 20:22:54 +00:00
|
|
|
{% endif %}
|
2018-12-28 05:03:42 +00:00
|
|
|
</div>
|
2018-10-25 00:15:23 +00:00
|
|
|
|
2018-12-28 05:03:42 +00:00
|
|
|
<div class="forum__actions__pagination">
|
|
|
|
{{ pag }}
|
|
|
|
</div>
|
2018-10-25 00:15:23 +00:00
|
|
|
</div>
|
2018-12-28 05:03:42 +00:00
|
|
|
{% endif %}
|
2018-10-25 00:15:23 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
2019-01-03 00:33:02 +00:00
|
|
|
{% macro forum_topic_tools(info, pagination_info, can_reply) %}
|
2018-10-25 00:15:23 +00:00
|
|
|
{% from 'macros.twig' import pagination %}
|
|
|
|
|
2019-02-28 21:52:39 +00:00
|
|
|
{% set pag = pagination(pagination_info, url('forum-topic'), null, {'t': info.topic_id}, 'page') %}
|
2018-12-28 05:03:42 +00:00
|
|
|
|
|
|
|
{% if can_reply or pag|trim|length > 0 %}
|
|
|
|
<div class="container forum__actions">
|
|
|
|
<div class="forum__actions__buttons">
|
|
|
|
{% if can_reply %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-reply-new', {'topic': info.topic_id}) }}" class="input__button">Reply</a>
|
2018-12-28 05:03:42 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-10-25 00:15:23 +00:00
|
|
|
|
2018-12-28 05:03:42 +00:00
|
|
|
<div class="forum__actions__pagination">
|
|
|
|
{{ pag }}
|
|
|
|
</div>
|
2018-10-25 00:15:23 +00:00
|
|
|
</div>
|
2018-12-28 05:03:42 +00:00
|
|
|
{% endif %}
|
2018-05-20 20:12:45 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
{% macro forum_category_entry(forum, forum_unread, forum_type) %}
|
2018-05-20 20:12:45 +00:00
|
|
|
{% set forum_type = forum_type|default(null) %}
|
2018-05-24 00:38:42 +00:00
|
|
|
{% set forum_unread = forum_unread|default(forum.forum_unread|default(false)) ? 'unread' : 'read' %}
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-05-20 20:12:45 +00:00
|
|
|
{% if forum_type is null %}
|
2018-05-18 01:20:27 +00:00
|
|
|
{% if forum.forum_archived is defined and forum.forum_archived %}
|
2018-09-28 16:40:41 +00:00
|
|
|
{% set forum_type = 'fas fa-archive' %}
|
2018-12-30 18:58:30 +00:00
|
|
|
{% elseif forum.forum_type is defined and forum.forum_type != constant('MSZ_FORUM_TYPE_DISCUSSION') %}
|
|
|
|
{% if forum.forum_type == constant('MSZ_FORUM_TYPE_LINK') %}
|
2018-09-28 16:40:41 +00:00
|
|
|
{% set forum_type = 'fas fa-link' %}
|
2018-12-30 18:58:30 +00:00
|
|
|
{% elseif forum.forum_type == constant('MSZ_FORUM_TYPE_CATEGORY') %}
|
2018-09-28 16:40:41 +00:00
|
|
|
{% set forum_type = 'fas fa-folder' %}
|
2018-05-18 01:20:27 +00:00
|
|
|
{% endif %}
|
2018-05-20 20:12:45 +00:00
|
|
|
{% else %}
|
2018-09-28 16:40:41 +00:00
|
|
|
{% set forum_type = 'fas fa-comments' %}
|
2018-05-18 01:20:27 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category">
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-category', {'forum': forum.forum_id}) }}" class="forum__category__link"></a>
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category__container">
|
|
|
|
<div class="forum__category__icon forum__category__icon--{{ forum_unread }}">
|
2019-01-18 15:55:48 +00:00
|
|
|
<i class="{{ forum_type }} fa-fw"></i>
|
2018-05-21 19:08:40 +00:00
|
|
|
</div>
|
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category__details">
|
|
|
|
<div class="forum__category__title">
|
|
|
|
{{ forum.forum_name }}
|
|
|
|
</div>
|
2018-05-21 19:08:40 +00:00
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category__description">
|
|
|
|
{{ forum.forum_description|nl2br }}
|
2018-05-19 00:51:31 +00:00
|
|
|
</div>
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
{% if forum.forum_subforums is defined and forum.forum_subforums|length > 0 %}
|
|
|
|
<div class="forum__category__subforums">
|
|
|
|
{% for subforum in forum.forum_subforums %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-category', {'forum': subforum.forum_id}) }}"
|
2018-09-28 16:40:41 +00:00
|
|
|
class="forum__category__subforum{% if subforum.forum_unread %} forum__category__subforum--unread{% endif %}">
|
|
|
|
{{ subforum.forum_name }}
|
|
|
|
</a>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
2018-12-30 18:58:30 +00:00
|
|
|
{% if forum.forum_type == constant('MSZ_FORUM_TYPE_LINK') %}
|
2018-09-28 16:40:41 +00:00
|
|
|
{% if forum.forum_link_clicks is not null %}
|
|
|
|
<div class="forum__category__stats">
|
|
|
|
<div class="forum__category__stat" title="Clicks">{{ forum.forum_link_clicks|number_format }}</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-12-30 18:58:30 +00:00
|
|
|
{% elseif forum.forum_type != constant('MSZ_FORUM_TYPE_CATEGORY') %}
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category__stats">
|
2019-02-26 14:35:35 +00:00
|
|
|
<div class="forum__category__stat" title="Topics">{{ forum.forum_count_topics|number_format }}</div>
|
|
|
|
<div class="forum__category__stat" title="Posts">{{ forum.forum_count_posts|number_format }}</div>
|
2018-05-21 19:08:40 +00:00
|
|
|
</div>
|
2018-05-22 02:09:53 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2018-12-30 18:58:30 +00:00
|
|
|
{% if forum.forum_type == constant('MSZ_FORUM_TYPE_DISCUSSION') or forum.forum_link_clicks is not null %}
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category__activity{% if forum.forum_link_clicks is not null %} forum__category__activity--empty{% endif %}">
|
2018-12-30 18:58:30 +00:00
|
|
|
{% if forum.forum_type != constant('MSZ_FORUM_TYPE_LINK') %}
|
2019-04-10 18:16:36 +00:00
|
|
|
{% if forum.recent_topic_id is not defined %}
|
2018-09-28 16:40:41 +00:00
|
|
|
<div class="forum__category__activity__none">
|
|
|
|
There are no posts in this forum yet.
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="forum__category__activity__details">
|
|
|
|
<a class="forum__category__activity__post"
|
2019-01-24 20:54:24 +00:00
|
|
|
href="{{ url('forum-post', {'post': forum.recent_post_id, 'post_fragment': 'p' ~ forum.recent_post_id}) }}">
|
2018-05-26 20:33:05 +00:00
|
|
|
{{ forum.recent_topic_title }}
|
2018-05-22 02:09:53 +00:00
|
|
|
</a>
|
2018-09-28 16:40:41 +00:00
|
|
|
|
|
|
|
<div class="forum__category__activity__info">
|
|
|
|
<time datetime="{{ forum.recent_post_created|date('c') }}"
|
|
|
|
title="{{ forum.recent_post_created|date('r') }}">{{ forum.recent_post_created|time_diff }}</time>
|
|
|
|
{% if forum.recent_post_user_id is not null %}
|
|
|
|
by
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('user-profile', {'user': forum.recent_post_user_id}) }}" class="forum__category__username"
|
2018-09-28 16:40:41 +00:00
|
|
|
style="{{ forum.recent_post_user_colour|html_colour }}">
|
|
|
|
{{ forum.recent_post_username }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-05-22 02:09:53 +00:00
|
|
|
</div>
|
|
|
|
|
2018-09-28 16:40:41 +00:00
|
|
|
{% if forum.recent_post_user_id is not null %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('user-profile', {'user': forum.recent_post_user_id}) }}"
|
2018-10-22 17:26:59 +00:00
|
|
|
class="avatar forum__category__avatar"
|
2019-03-25 20:11:31 +00:00
|
|
|
style="background-image:url('{{ url('user-avatar', {'user': forum.recent_post_user_id, 'res': 80}) }}')">
|
2018-09-28 16:40:41 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
2018-05-21 19:08:40 +00:00
|
|
|
{% endif %}
|
2018-05-22 02:09:53 +00:00
|
|
|
{% endif %}
|
2018-09-28 16:40:41 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-05-18 01:20:27 +00:00
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2018-05-23 01:41:57 +00:00
|
|
|
{% macro forum_topic_locked(locked, archived) %}
|
|
|
|
{% if locked is not null or archived %}
|
2018-10-22 17:26:59 +00:00
|
|
|
<div class="container forum__status">
|
2018-10-15 20:45:06 +00:00
|
|
|
<div class="forum__status__icon">
|
2019-01-02 21:55:55 +00:00
|
|
|
<div class="forum__status__icon__background"></div>
|
2018-10-15 20:45:06 +00:00
|
|
|
<i class="fas fa-{{ archived ? 'archive' : 'lock' }}"></i>
|
|
|
|
</div>
|
2018-10-15 14:29:35 +00:00
|
|
|
<div class="forum__status__text">
|
2018-05-23 01:41:57 +00:00
|
|
|
{% if archived %}
|
2018-10-15 14:29:35 +00:00
|
|
|
This topic has been <span class="forum__status__emphasis">archived</span>.
|
2018-05-23 01:41:57 +00:00
|
|
|
{% else %}
|
2018-10-15 20:45:06 +00:00
|
|
|
This topic was locked
|
|
|
|
<time class="forum__status__emphasis"
|
2018-05-26 21:36:15 +00:00
|
|
|
datetime="{{ locked|date('c') }}"
|
|
|
|
title="{{ locked|date('r') }}">{{ locked|time_diff }}</time>.
|
2018-05-23 01:41:57 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
2018-05-18 01:20:27 +00:00
|
|
|
{% macro forum_topic_listing(topics) %}
|
|
|
|
{% from _self import forum_topic_entry %}
|
2018-10-22 19:53:21 +00:00
|
|
|
{% from 'macros.twig' import container_title %}
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-10-22 17:26:59 +00:00
|
|
|
<div class="container forum__topics">
|
2018-12-27 02:59:57 +00:00
|
|
|
{{ container_title('<i class="fas fa-comments fa-fw"></i> Topics') }}
|
2018-10-22 19:53:21 +00:00
|
|
|
|
2018-10-15 20:39:31 +00:00
|
|
|
<div class="forum__topics__list">
|
2018-05-18 01:20:27 +00:00
|
|
|
{% if topics|length > 0 %}
|
|
|
|
{% for topic in topics %}
|
|
|
|
{{ forum_topic_entry(topic) }}
|
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
2018-10-15 20:39:31 +00:00
|
|
|
<div class="forum__topics__empty">
|
2018-05-18 01:20:27 +00:00
|
|
|
There are no topics in this forum.
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2018-10-15 14:29:35 +00:00
|
|
|
{% macro forum_topic_entry(topic, topic_type, topic_unread) %}
|
2018-05-20 01:16:29 +00:00
|
|
|
{% set topic_type = topic_type|default(null) %}
|
2019-01-18 15:55:48 +00:00
|
|
|
{% set topic_unread = topic_unread|default(topic.topic_unread|default(false)) %}
|
2019-01-03 16:06:35 +00:00
|
|
|
{% set topic_important = topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') or topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %}
|
2018-05-20 01:16:29 +00:00
|
|
|
|
|
|
|
{% if topic_type is null %}
|
|
|
|
{% if topic.topic_deleted is defined and topic.topic_deleted is not null %}
|
2018-10-15 14:29:35 +00:00
|
|
|
{% set topic_type = 'fas fa-trash-alt' %}
|
2018-12-30 18:58:30 +00:00
|
|
|
{% elseif topic.topic_type is defined and topic.topic_type != constant('MSZ_TOPIC_TYPE_DISCUSSION') %}
|
|
|
|
{% if topic.topic_type == constant('MSZ_TOPIC_TYPE_ANNOUNCEMENT') or topic.topic_type == constant('MSZ_TOPIC_TYPE_GLOBAL_ANNOUNCEMENT') %}
|
2018-10-15 14:29:35 +00:00
|
|
|
{% set topic_type = 'fas fa-bullhorn' %}
|
2018-12-30 18:58:30 +00:00
|
|
|
{% elseif topic.topic_type == constant('MSZ_TOPIC_TYPE_STICKY') %}
|
2018-10-15 14:29:35 +00:00
|
|
|
{% set topic_type = 'fas fa-thumbtack' %}
|
2018-05-20 01:16:29 +00:00
|
|
|
{% endif %}
|
2018-05-23 01:41:57 +00:00
|
|
|
{% elseif topic.topic_locked is defined and topic.topic_locked is not null %}
|
2018-10-15 14:29:35 +00:00
|
|
|
{% set topic_type = 'fas fa-lock' %}
|
2018-05-20 01:16:29 +00:00
|
|
|
{% else %}
|
2019-01-18 15:55:48 +00:00
|
|
|
{% set topic_type = (topic_unread ? 'fas' : 'far') ~ ' fa-comment' %}
|
2018-05-20 01:16:29 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2019-01-03 16:06:35 +00:00
|
|
|
<div class="forum__topic{% if topic.topic_deleted is not null %} forum__topic--deleted{% elseif topic.topic_locked is not null and not topic_important %} forum__topic--locked{% endif %}">
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-topic', {'topic': topic.topic_id}) }}" class="forum__topic__link"></a>
|
2018-05-20 01:16:29 +00:00
|
|
|
|
2018-10-15 20:39:31 +00:00
|
|
|
<div class="forum__topic__container">
|
2019-01-18 15:55:48 +00:00
|
|
|
<div class="forum__topic__icon forum__topic__icon--{{ topic_unread ? 'unread' : 'read' }}">
|
|
|
|
<i class="{{ topic_type }} fa-fw"></i>
|
|
|
|
|
|
|
|
{% if topic.topic_participated %}
|
|
|
|
<div class="forum__topic__icon__participated" title="You have posted in this topic"></div>
|
|
|
|
{% endif %}
|
2018-05-18 01:20:27 +00:00
|
|
|
</div>
|
2018-05-21 16:37:17 +00:00
|
|
|
|
2018-10-15 20:39:31 +00:00
|
|
|
<div class="forum__topic__details">
|
|
|
|
<div class="forum__topic__title">
|
|
|
|
<span class="forum__topic__title__inner">
|
|
|
|
{{ topic.topic_title }}
|
|
|
|
</span>
|
|
|
|
</div>
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-10-15 20:39:31 +00:00
|
|
|
<div class="forum__topic__info">
|
|
|
|
{% if topic.author_id is not null %}
|
|
|
|
by <a
|
2019-01-24 20:54:24 +00:00
|
|
|
href="{{ url('user-profile', {'user': topic.author_id}) }}"
|
2018-10-15 20:39:31 +00:00
|
|
|
class="forum__topic__username"
|
|
|
|
style="{{ topic.author_colour|html_colour }}">{{ topic.author_name }}</a>,
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
<time datetime="{{ topic.topic_created|date('c') }}" title="{{ topic.topic_created|date('r') }}">{{ topic.topic_created|time_diff }}</time>
|
|
|
|
</div>
|
2019-01-04 01:40:18 +00:00
|
|
|
|
|
|
|
{% if topic.topic_pages|default(0) > 1 %}
|
|
|
|
<div class="forum__topic__pagination">
|
|
|
|
<div class="forum__topic__pagination__title">
|
|
|
|
Page:
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% for i in 1..topic.topic_pages|clamp(0, 3) %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-topic', {'topic': topic.topic_id, 'page': i}) }}" class="forum__topic__pagination__item">
|
2019-01-04 01:40:18 +00:00
|
|
|
{{ i }}
|
|
|
|
</a>
|
|
|
|
{% endfor %}
|
|
|
|
{% if topic.topic_pages > 3 %}
|
|
|
|
{% if topic.topic_pages > 6 %}
|
|
|
|
<div class="forum__topic__pagination__separator">
|
|
|
|
<i class="fas fa-ellipsis-h"></i>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% for i in (topic.topic_pages - 2)|clamp(4, topic.topic_pages)..topic.topic_pages %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-topic', {'topic': topic.topic_id, 'page': i}) }}" class="forum__topic__pagination__item">
|
2019-01-04 01:40:18 +00:00
|
|
|
{{ i }}
|
|
|
|
</a>
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-05-20 01:16:29 +00:00
|
|
|
</div>
|
2018-10-15 20:39:31 +00:00
|
|
|
|
|
|
|
<div class="forum__topic__stats">
|
2019-03-03 15:26:23 +00:00
|
|
|
<div class="forum__topic__stat" title="Posts">{{ topic.topic_count_posts|number_format }}</div>
|
|
|
|
<div class="forum__topic__stat" title="Views">{{ topic.topic_count_views|number_format }}</div>
|
2018-05-20 01:16:29 +00:00
|
|
|
</div>
|
2018-05-18 01:20:27 +00:00
|
|
|
|
2018-10-15 20:39:31 +00:00
|
|
|
<div class="forum__topic__activity">
|
|
|
|
<div class="forum__topic__activity__details">
|
|
|
|
{% if topic.respondent_id is not null %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('user-profile', {'user': topic.respondent_id}) }}" class="forum__topic__username"
|
2018-10-15 20:39:31 +00:00
|
|
|
style="{{ topic.respondent_colour|html_colour }}">{{ topic.respondent_name }}</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<a class="forum__topic__activity__post"
|
2019-01-24 20:54:24 +00:00
|
|
|
href="{{ url('forum-post', {'post': topic.response_id, 'post_fragment': 'p' ~ topic.response_id}) }}">
|
2018-10-15 20:39:31 +00:00
|
|
|
<time datetime="{{ topic.response_created|date('c') }}"
|
2018-05-26 21:36:15 +00:00
|
|
|
title="{{ topic.response_created|date('r') }}">{{ topic.response_created|time_diff }}</time>
|
2018-05-20 20:12:45 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
2018-10-15 20:39:31 +00:00
|
|
|
|
2018-05-21 19:15:08 +00:00
|
|
|
{% if topic.respondent_id is not null %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('user-profile', {'user': topic.respondent_id}) }}"
|
2018-10-22 17:26:59 +00:00
|
|
|
class="avatar forum__topic__avatar"
|
2019-03-25 20:11:31 +00:00
|
|
|
style="background-image:url('{{ url('user-avatar', {'user': topic.respondent_id, 'res': 60}) }}')">
|
2018-10-15 20:39:31 +00:00
|
|
|
</a>
|
2018-05-21 19:15:08 +00:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-05-20 20:12:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2018-12-30 03:23:04 +00:00
|
|
|
{% macro forum_post_listing(posts, user_id, perms) %}
|
2018-05-20 20:12:45 +00:00
|
|
|
{% from _self import forum_post_entry %}
|
|
|
|
|
2018-05-21 23:05:25 +00:00
|
|
|
{% for post in posts %}
|
2019-01-10 20:08:37 +00:00
|
|
|
{{ forum_post_entry(post, user_id, perms) }}
|
2018-05-21 23:05:25 +00:00
|
|
|
{% endfor %}
|
2018-05-20 20:12:45 +00:00
|
|
|
{% endmacro %}
|
|
|
|
|
2019-01-10 20:08:37 +00:00
|
|
|
{% macro forum_post_entry(post, user_id, perms) %}
|
|
|
|
{% set is_deleted = post.post_deleted is not null %}
|
|
|
|
{% set can_post = perms|perms_check(constant('MSZ_FORUM_PERM_CREATE_POST')) %}
|
|
|
|
{% set can_edit = perms|perms_check(constant('MSZ_FORUM_PERM_EDIT_ANY_POST')) or (
|
|
|
|
user_id == post.poster_id
|
|
|
|
and perms|perms_check(constant('MSZ_FORUM_PERM_EDIT_POST'))
|
|
|
|
) %}
|
|
|
|
{% set can_delete = not post.is_opening_post and (
|
|
|
|
perms|perms_check(constant('MSZ_FORUM_PERM_DELETE_ANY_POST')) or (
|
|
|
|
user_id == post.poster_id
|
|
|
|
and perms|perms_check(constant('MSZ_FORUM_PERM_DELETE_POST'))
|
|
|
|
and post.post_created|date('U') > ''|date('U') - constant('MSZ_FORUM_POST_DELETE_LIMIT')
|
|
|
|
)
|
|
|
|
) %}
|
2018-05-20 20:12:45 +00:00
|
|
|
|
2018-12-30 03:02:35 +00:00
|
|
|
<div class="container forum__post{% if is_deleted %} forum__post--deleted{% endif %}" id="p{{ post.post_id }}" style="{{ post.poster_colour|html_colour('--accent-colour') }}">
|
2018-10-22 20:23:56 +00:00
|
|
|
<div class="forum__post__info">
|
|
|
|
<div class="forum__post__info__background"></div>
|
2019-01-18 20:24:35 +00:00
|
|
|
<div class="forum__post__info__content">
|
2018-10-22 20:23:56 +00:00
|
|
|
{% if post.poster_id is not null %}
|
|
|
|
<a class="avatar forum__post__avatar"
|
2019-03-25 20:11:31 +00:00
|
|
|
style="background-image:url('{{ url('user-avatar', {'user': post.poster_id, 'res': 240}) }}');"
|
2019-01-24 20:54:24 +00:00
|
|
|
href="{{ url('user-profile', {'user': post.poster_id}) }}">
|
2018-10-22 20:23:56 +00:00
|
|
|
</a>
|
2018-10-15 21:57:16 +00:00
|
|
|
|
2019-01-24 20:54:24 +00:00
|
|
|
<a class="forum__post__username" href="{{ url('user-profile', {'user': post.poster_id}) }}">{{ post.poster_name }}</a>
|
2019-01-22 13:58:57 +00:00
|
|
|
|
|
|
|
{% if post.poster_title|length > 0 %}
|
|
|
|
<div class="forum__post__usertitle">{{ post.poster_title }}</div>
|
|
|
|
{% endif %}
|
2018-10-22 20:23:56 +00:00
|
|
|
|
|
|
|
<div class="forum__post__icons">
|
|
|
|
<div class="flag flag--{{ post.poster_country|lower }}" title="{{ post.poster_country|country_name }}"></div>
|
|
|
|
<div class="forum__post__posts-count">{{ post.poster_post_count|number_format }} posts</div>
|
|
|
|
</div>
|
|
|
|
|
2019-01-22 13:58:57 +00:00
|
|
|
{% if post.is_original_poster %}
|
|
|
|
<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 %}
|
|
|
|
|
2018-10-22 20:23:56 +00:00
|
|
|
<div class="forum__post__joined">
|
|
|
|
joined <time datetime="{{ post.poster_joined|date('c') }}" title="{{ post.poster_joined|date('r') }}">{{ post.poster_joined|time_diff }}</time>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="forum__post__username">Deleted User</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-10-15 21:57:16 +00:00
|
|
|
</div>
|
2018-05-21 02:28:51 +00:00
|
|
|
|
2019-01-06 21:40:58 +00:00
|
|
|
<div class="forum__post__content">
|
2019-01-24 20:54:24 +00:00
|
|
|
{% set post_link = url(post.is_opening_post ? 'forum-topic' : 'forum-post', {'topic': post.topic_id, 'post': post.post_id, 'post_fragment': 'p%d'|format(post.post_id)}) %}
|
2019-01-10 20:38:20 +00:00
|
|
|
|
2018-10-15 21:57:16 +00:00
|
|
|
<div class="forum__post__details">
|
2019-01-10 20:38:20 +00:00
|
|
|
<a class="forum__post__datetime" href="{{ post_link }}">
|
2018-05-26 21:36:15 +00:00
|
|
|
<time datetime="{{ post.post_created|date('c') }}" title="{{ post.post_created|date('r') }}">{{ post.post_created|time_diff }}</time>
|
2018-12-30 03:02:35 +00:00
|
|
|
{% if post.post_edited is not null %}
|
|
|
|
(edited <time datetime="{{ post.post_edited|date('c') }}" title="{{ post.post_edited|date('r') }}">{{ post.post_edited|time_diff }}</time>)
|
|
|
|
{% endif %}
|
2018-05-21 02:28:51 +00:00
|
|
|
</a>
|
2018-10-15 21:57:16 +00:00
|
|
|
|
2019-01-10 20:38:20 +00:00
|
|
|
<a class="forum__post__id" href="{{ post_link }}">
|
2018-05-21 02:28:51 +00:00
|
|
|
#{{ post.post_id }}
|
|
|
|
</a>
|
|
|
|
</div>
|
2018-10-15 21:57:16 +00:00
|
|
|
|
2018-11-01 21:35:10 +00:00
|
|
|
<div class="forum__post__text{% if post.post_parse == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
|
2018-09-21 08:56:52 +00:00
|
|
|
{{ post.post_text|escape|parse_text(post.post_parse)|raw }}
|
2018-05-21 02:28:51 +00:00
|
|
|
</div>
|
2018-12-30 03:02:35 +00:00
|
|
|
|
|
|
|
{% if can_post or can_edit or can_delete %}
|
|
|
|
<div class="forum__post__actions">
|
|
|
|
{% if is_deleted %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-post-restore', {'post': post.post_id}) }}" class="forum__post__action forum__post__action--restore"><i class="fas fa-magic fa-fw"></i> Restore</a>
|
|
|
|
<a href="{{ url('forum-post-nuke', {'post': post.post_id}) }}" class="forum__post__action forum__post__action--nuke"><i class="fas fa-radiation-alt fa-fw"></i> Permanently Delete</a>
|
2018-12-30 03:02:35 +00:00
|
|
|
{% else %}
|
|
|
|
{# if can_post %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-post-quote', {'post': post.post_id}) }}" class="forum__post__action forum__post__action--quote"><i class="fas fa-quote-left fa-fw"></i> Quote</a>
|
2018-12-30 03:02:35 +00:00
|
|
|
{% endif #}
|
|
|
|
{% if can_edit %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-post-edit', {'post': post.post_id}) }}" class="forum__post__action forum__post__action--edit"><i class="fas fa-edit fa-fw"></i> Edit</a>
|
2019-01-10 20:08:37 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if can_delete %}
|
2019-01-24 20:54:24 +00:00
|
|
|
<a href="{{ url('forum-post-delete', {'post': post.post_id}) }}" class="forum__post__action forum__post__action--delete"><i class="far fa-trash-alt fa-fw"></i> Delete</a>
|
2018-12-30 03:02:35 +00:00
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2019-01-18 22:24:37 +00:00
|
|
|
|
|
|
|
{% if post.post_display_signature and post.poster_signature_content|length > 0 %}
|
|
|
|
<div class="forum__post__signature{% if post.poster_signature_parser == constant('MSZ_PARSER_MARKDOWN') %} markdown{% endif %}">
|
|
|
|
{{ post.poster_signature_content|escape|parse_text(post.poster_signature_parser)|raw }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-05-20 20:12:45 +00:00
|
|
|
</div>
|
2018-05-18 01:20:27 +00:00
|
|
|
</div>
|
|
|
|
{% endmacro %}
|