This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/resources/views/yuuno/forum/topic.twig

196 lines
12 KiB
Twig
Raw Normal View History

2016-07-31 19:36:13 +00:00
{% extends 'master.twig' %}
{% set forumBackLink %}{{ route('forums.forum', forum.id) }}{% endset %}
2016-07-31 01:32:37 +00:00
{% set title %}{% if topic is defined %}{{ topic.title }}{% else %}Creating topic in {{ forum.name }}{% endif %}{% endset %}
2016-07-30 13:48:09 +00:00
{% if topic is defined %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::REPLY'), user.id)
and (
2016-07-30 13:48:09 +00:00
topic.status != 1
or forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id)
) %}
{% set forumReplyLink %}#reply{% endset %}
{% endif %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::STICKY'), user.id)
or forum.permission(constant('Sakura\\Perms\\Forum::ANNOUNCEMENT'), user.id)
or forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id)
or forum.permission(constant('Sakura\\Perms\\Forum::MOVE'), user.id)
or forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
{% set showMod = true %}
{% endif %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::STICKY'), user.id) %}
2016-07-30 13:48:09 +00:00
{% set forumSticky = topic.type == 1 ? true : false %}
{% endif %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::ANNOUNCEMENT'), user.id) %}
2016-07-30 13:48:09 +00:00
{% set forumAnnounce = topic.type == 2 ? true : false %}
{% endif %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::LOCK'), user.id) %}
2016-07-30 13:48:09 +00:00
{% set forumLock = topic.status == 1 ? true : false %}
{% endif %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::MOVE'), user.id) %}
2016-07-30 13:48:09 +00:00
{% if topic.oldForum %}
{% set forumRestore = true %}
{% endif %}
2016-07-31 01:32:37 +00:00
{% if topic.forum != config('forum.trash') %}
{% set forumTrash = true %}
{% endif %}
{% endif %}
{% if forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
2016-07-31 01:32:37 +00:00
{% if topic.forum == config('forum.trash') %}
{% set forumPrune = true %}
{% endif %}
{% endif %}
2016-07-30 13:48:09 +00:00
{% set posts = topic.posts|batch(10) %}
{% set paginationPages = posts %}
2016-07-30 13:48:09 +00:00
{% set paginationUrl %}{{ route('forums.topic', topic.id) }}{% endset %}
{% endif %}
{% block css %}
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/default.min.css">
{% endblock %}
{% block js %}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min.js"></script>
<script type="text/javascript">
2016-09-19 18:32:24 +00:00
function deletePost(id) {
var confirm = new Sakura.Dialogue;
confirm.SetType(Sakura.DialogueType.Confirm);
confirm.Text = "Are you sure?";
confirm.AddCallback(Sakura.DialogueButton.Yes, function () {
var deleter = new Sakura.AJAX;
deleter.SetUrl("{{ route('forums.post.delete', 1) }}".replace('1', id));
deleter.AddCallback(200, function () {
Sakura.DOM.Remove(Sakura.DOM.ID('p' + id));
});
deleter.AddCallback(0, function () {
var error = new Sakura.Dialogue;
error.Text = "Deletion failed!";
error.AddCallback(Sakura.DialogueButton.Ok, function () {
this.Close();
});
error.Display();
});
deleter.Start(Sakura.HTTPMethod.DELETE);
this.Close();
});
confirm.AddCallback(Sakura.DialogueButton.No, function () {
this.Close();
});
confirm.Display();
}
hljs.initHighlightingOnLoad();
</script>
{% endblock %}
{% block content %}
<div class="content homepage forum viewtopic">
<div class="content-column">
2016-07-30 13:48:09 +00:00
<div class="head">{{ forum.name }} / <span id="topicTitle">{{ topic.title }}</span></div>
{% include 'forum/elements/forumBtns.twig' %}
<table class="posts">
2016-07-30 13:48:09 +00:00
{% if topic is defined %}
{% set textCache = session.replyText['t' ~ topic.id] %}
{% set postingAction = route('forums.topic.reply', topic.id) %}
{% for post in posts[get.page|default(1) - 1] %}
<tr class="post" id="p{{ post.id }}">
<td class="userpanel">
{% if post.poster.activated or post.poster.restricted %}<a href="{{ route('user.profile', post.poster.id) }}" class="default username" style="color: {{ post.poster.colour }}; text-shadow: 0 0 5px {% if post.poster.colour != 'inherit' %}{{ post.poster.colour }}{% else %}#222{% endif %};" title="Go to {{ post.poster.username }}'s profile">{{ post.poster.username }}</a>
2016-09-13 22:05:03 +00:00
<img src="{{ route('user.avatar', post.poster.id) }}" alt="{{ post.poster.username }}" class="avatar" style="box-shadow: 0 3px 7px #{% if post.poster.isOnline %}484{% else %}844{% endif %};">
{% else %}
<a class="username">[deleted user]</a>
{% endif %}
<div class="userdata">
<div class="usertitle">{{ post.poster.title }}</div>
2016-07-30 13:48:09 +00:00
<img src="/images/tenshi.png" alt="Tenshi"{% if not post.poster.isPremium %} style="opacity: 0;"{% endif %}> <img src="/images/flags/{{ post.poster.country|lower }}.png" alt="{{ post.poster.country(true) }}">{% if post.poster.id == (topic.posts|first).poster.id %} <img src="/images/op.png" alt="OP" title="Original Poster">{% endif %}
{% if user.isActive %}
<div class="actions">
{% if (user.id == post.poster.id and forum.permission(constant('Sakura\\Perms\\Forum::EDIT_OWN'), user.id)) or forum.permission(constant('Sakura\\Perms\\Forum::EDIT_ANY'), user.id) %}
<a class="fa fa-pencil-square-o" title="Edit this post" href="javascript:void(0);" onclick="editPost({{ post.id }});"></a>
{% endif %}
{% if (user.id == post.poster.id and forum.permission(constant('Sakura\\Perms\\Forum::DELETE_OWN'), user.id)) or forum.permission(constant('Sakura\\Perms\\Forum::DELETE_ANY'), user.id) %}
2016-09-19 18:32:24 +00:00
<a class="fa fa-trash" title="Delete this post" href="javascript:;" onclick="deletePost({{ post.id }})"></a>
{% endif %}
{% if not (post.poster.activated or post.poster.restricted or user.id == post.poster.id) %}
<a class="fa fa-{% if user.isFriends(post.poster.id) == 2 %}heart{% else %}star{% endif %} friend-{{ post.poster.id }}-level" title="You are friends" {% if user.isFriends(post.poster.id) == 0 %}style="display: none;"{% endif %}></a>
2016-07-31 19:36:13 +00:00
<a class="fa fa-user-{% if user.isFriends(post.poster.id) == 0 %}plus{% else %}times{% endif %} forum-friend-toggle friend-{{ post.poster.id }}-toggle" title="{% if user.isFriends(post.poster.id) == 0 %}Add {{ post.poster.username }} as a friend{% else %}Remove friend{% endif %}" href="javascript:void(0);" onclick="Sakura.Friend.{% if user.isFriends(post.poster.id) == 0 %}Add({{ post.poster.id }}){% else %}Remove({{ post.poster.id }}){% endif %}"></a>
<a class="fa fa-flag" title="Report {{ post.poster.username }}" href="{{ route('user.report', post.poster.id) }}"></a>
{% endif %}
2016-08-05 20:53:29 +00:00
<a class="fa fa-reply" title="Quote this post" href="javascript:void(0);" onclick="Sakura.Editor.QuotePost({{ post.id }}, '{{ post.poster.username }}', pText);"></a>
</div>
{% endif %}
</div>
</td>
<td class="post-content">
<div class="details">
<div class="subject">
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
</div>
<div class="date">
2016-08-04 21:24:08 +00:00
<a href="{{ route('forums.post', post.id) }}" class="clean">#{{ post.id }} - <time class="time-ago" datetime="{{ post.time|date('r') }}">{{ post.time|date(config('general.date_format')) }}</time></a>
</div>
<div class="clear"></div>
</div>
<div class="post-text bbcode">
{{ post.parsed|raw }}
</div>
{% if post.poster.signature and post.poster.perms.changeSignature %}
<div class="clear"></div>
<div class="signature bbcode">
{{ post.poster.signature()|raw|nl2br }}
</div>
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
{% set titleCache = session.replyText['f' ~ forum.id].title %}
{% set textCache = session.replyText['f' ~ forum.id].text %}
{% set postingAction = route('forums.new', forum.id) %}
{% endif %}
2016-07-30 13:48:09 +00:00
{% if forumReplyLink is defined or topic is not defined %}
<tr class="post" id="postingPreview" style="display: none;">
<td class="userpanel">
<a class="default username" href="{{ route('user.profile', user.id) }}" style="color: {{ user.colour }}; text-shadow: 0 0 5px {% if user.colour != 'inherit' %}{{ user.colour }}{% else %}#222{% endif %};" title="Go to {{ user.username }}'s profile">{{ user.username }}</a>
2016-09-13 22:05:03 +00:00
<img src="{{ route('user.avatar', user.id) }}" alt="{{ user.username }}" class="avatar" style="box-shadow: 0 3px 7px #484;">
<div class="userdata">
<div class="usertitle">{{ user.title }}</div>
2016-07-30 13:48:09 +00:00
<img src="/images/tenshi.png" alt="Tenshi"{% if not user.isPremium %} style="opacity: 0;"{% endif %}> <img src="/images/flags/{{ user.country|lower }}.png" alt="{{ user.country(true) }}">{% if user.id == (topic.posts|first).poster.id %} <img src="/images/op.png" alt="OP" title="Original Poster">{% endif %}
</div>
</td>
<td class="post-content">
<div class="details">
2016-07-30 13:48:09 +00:00
<div class="subject" id="previewTitle">{% if titleCache is not defined %}Re: {{ topic.title }}{% endif %}</div>
<div class="date" id="previewMode">Preview</div>
<div class="clear"></div>
</div>
<div class="post-text bbcode" id="previewText"></div>
{% if user.signature and user.perms.changeSignature %}
<div class="clear"></div>
<div class="signature bbcode">
{{ user.signature()|raw|nl2br }}
</div>
{% endif %}
</td>
</tr>
{% endif %}
</table>
2016-07-30 13:48:09 +00:00
{% if forumReplyLink is defined or topic is not defined %}
{% include 'forum/elements/replyForm.twig' %}
{% endif %}
{% include 'forum/elements/forumBtns.twig' %}
</div>
</div>
{% endblock %}