misuzu/templates/forum/topic.twig

97 lines
3.7 KiB
Twig
Raw Normal View History

2018-08-15 03:12:58 +02:00
{% extends 'forum/master.twig' %}
2018-10-21 23:53:32 +02:00
{% from 'macros.twig' import pagination %}
2018-05-23 03:41:57 +02:00
{%
2018-08-15 03:12:58 +02:00
from 'forum/macros.twig'
2018-05-23 03:41:57 +02:00
import
forum_post_listing,
forum_topic_buttons,
forum_topic_locked,
2018-10-25 02:15:23 +02:00
forum_header,
forum_topic_tools,
forum_topic_redirect
2018-05-23 03:41:57 +02:00
%}
2018-05-20 22:12:45 +02:00
2023-08-28 01:17:34 +00:00
{% set title = topic_info.title %}
{% set canonical_url = url('forum-topic', {
2023-08-28 01:17:34 +00:00
'topic': topic_info.id,
2019-01-04 01:11:31 +01:00
'page': topic_pagination.page > 1 ? topic_pagination.page : 0,
2018-07-07 22:11:16 +02:00
}) %}
2018-05-22 01:05:25 +02:00
2019-01-03 01:33:02 +01:00
{% set topic_tools = forum_topic_tools(topic_info, topic_pagination, can_reply) %}
{% set topic_notice = forum_topic_locked(topic_info.lockedTime, category_info.archived) ~ forum_topic_redirect(topic_redir_info|default(null)) %}
2019-01-12 00:00:53 +01:00
{% set topic_actions = [
{
html: '<i class="fas fa-trash-alt fa-fw"></i> <span class="js-action-text">Delete</span>',
display: topic_can_delete,
method: 'DELETE',
url: url('forum-topic-delete', { topic: topic_info.id }),
confirm: 'Are you sure you want to delete this topic?',
disableWith: 'Deleting...',
disableWithTarget: '.js-action-text',
withCsrf: true,
refreshOnSuccess: topic_can_delete_any,
redirectOnSuccess: (topic_can_delete_any ? false : url('forum-category', { forum: category_info.id })),
2019-01-12 00:00:53 +01:00
},
{
html: '<i class="fas fa-magic fa-fw"></i> <span class="js-action-text">Restore</span>',
display: topic_can_nuke_or_restore,
method: 'POST',
url: url('forum-topic-restore', { topic: topic_info.id }),
confirm: 'Are you sure you want to restore this topic?',
disableWith: 'Restoring...',
disableWithTarget: '.js-action-text',
withCsrf: true,
refreshOnSuccess: true,
2019-01-12 00:00:53 +01:00
},
{
html: '<i class="fas fa-radiation-alt fa-fw"></i> <span class="js-action-text">Permanently Delete</span>',
display: topic_can_nuke_or_restore,
method: 'POST',
url: url('forum-topic-nuke', { topic: topic_info.id }),
confirm: 'Are you sure you want to PERMANENTLY DELETE this topic?',
disableWith: 'Nuking...',
disableWithTarget: '.js-action-text',
withCsrf: true,
redirectOnSuccess: url('forum-category', { forum: category_info.id }),
2019-01-12 00:00:53 +01:00
},
{
html: '<i class="fas fa-arrow-alt-circle-up fa-fw"></i> <span class="js-action-text">Bump</span>',
display: topic_can_bump,
method: 'POST',
url: url('forum-topic-bump', { topic: topic_info.id }),
disableWith: 'Bumping...',
disableWithTarget: '.js-action-text',
withCsrf: true,
2019-01-12 00:00:53 +01:00
},
{
html: '<i class="fas fa-lock fa-fw"></i> <span class="js-action-text">Lock</span>',
display: topic_can_lock and not topic_info.locked,
method: 'POST',
url: url('forum-topic-lock', { topic: topic_info.id }),
disableWith: 'Locking...',
disableWithTarget: '.js-action-text',
withCsrf: true,
refreshOnSuccess: true,
2019-01-12 00:00:53 +01:00
},
{
html: '<i class="fas fa-lock-open fa-fw"></i> <span class="js-action-text">Unlock</span>',
display: topic_can_lock and topic_info.locked,
method: 'POST',
url: url('forum-topic-unlock', { topic: topic_info.id }),
disableWith: 'Unlocking...',
disableWithTarget: '.js-action-text',
withCsrf: true,
refreshOnSuccess: true,
2019-01-12 00:00:53 +01:00
},
] %}
2018-05-20 22:12:45 +02:00
{% block content %}
2023-08-28 01:17:34 +00:00
{{ forum_header(topic_info.title, topic_breadcrumbs, false, canonical_url, topic_actions) }}
{{ topic_notice|raw }}
2018-10-25 02:15:23 +02:00
{{ topic_tools }}
{{ forum_post_listing(topic_posts, topic_user_id, topic_perms) }}
2018-10-25 02:15:23 +02:00
{{ topic_tools }}
{{ topic_notice|raw }}
{{ forum_header('', topic_breadcrumbs) }}
2018-05-20 22:12:45 +02:00
{% endblock %}