misuzu/templates/forum/posting.twig

102 lines
5.2 KiB
Twig

{% extends 'forum/master.twig' %}
{% from 'forum/macros.twig' import forum_header %}
{% from '_layout/input.twig' import input_hidden, input_csrf, input_text, input_button, input_select, input_checkbox %}
{% set title = 'Posting' %}
{% set is_reply = posting_topic is defined %}
{% set is_opening = not is_reply or posting_post.is_opening_post|default(false) %}
{% block content %}
<form method="post" action="/forum/posting.php">
{{ input_hidden('post[' ~ (is_reply ? 'topic' : 'forum') ~ ']', is_reply ? posting_topic.topic_id : posting_forum.forum_id) }}
{{ input_hidden('post[mode]', posting_mode) }}
{{ input_csrf('forum_post') }}
{{ forum_header(
is_reply and not is_opening
? posting_topic.topic_title
: input_text(
'post[title]',
'forum__header__input',
posting_defaults.title|default(posting_topic.topic_title|default('')),
'text',
'Enter your title here...'
),
posting_breadcrumbs,
false,
is_reply and not is_opening
? '/forum/topic.php?t=' ~ posting_topic.topic_id
: ''
) }}
{% if posting_post is defined %}
{{ input_hidden('post[id]', posting_post.post_id) }}
{% endif %}
{% if posting_notices|length > 0 %}
<div class="warning">
<div class="warning__content">
{% for notice in posting_notices %}
<p>{{ notice }}</p>
{% endfor %}
</div>
</div>
{% endif %}
<div class="container forum__post" style="{{ posting_post.poster_colour|default(current_user.user_colour)|html_colour('--accent-colour') }}">
<div class="forum__post__info">
<div class="forum__post__info__background"></div>
<div class="forum__post__info__content">
<span class="avatar forum__post__avatar" style="background-image:url('/profile.php?u={{ posting_post.poster_id|default(current_user.user_id) }}&amp;m=avatar');"></span>
<span class="forum__post__username">{{ posting_post.poster_name|default(current_user.username) }}</span>
<div class="forum__post__icons">
<div class="flag flag--{{ posting_post.poster_country|default(posting_info.user_country)|lower }}" title="{{ posting_post.poster_country|default(posting_info.user_country)|country_name }}"></div>
<div class="forum__post__posts-count">{{ posting_post.poster_post_count|default(posting_info.user_forum_posts)|number_format }} posts</div>
</div>
<div class="forum__post__joined">
joined <time datetime="{{ posting_post.poster_joined|default(posting_info.user_created)|date('c') }}" title="{{ posting_post.poster_joined|default(posting_info.user_created)|date('r') }}">{{ posting_post.poster_joined|default(posting_info.user_created)|time_diff }}</time>
</div>
</div>
</div>
<div class="forum__post__content">
<textarea name="post[text]" class="forum__post__text forum__post__text--edit" placeholder="Type your post content here...">{{ posting_defaults.text|default(posting_post.post_text|default('')) }}</textarea>
<div class="forum__post__options">
<div class="forum__post__settings">
{{ input_select(
'post[parser]',
constant('MSZ_PARSERS_NAMES'),
posting_defaults.parser|default(posting_post.post_parse|default(posting_info.user_post_parse|default(constant('MSZ_PARSER_BBCODE')))),
null, null, false, 'forum__post__dropdown'
) }}
{% if is_opening and posting_types|length > 1 %}
{{ input_select(
'post[type]',
posting_types,
posting_defaults.type|default(posting_topic.topic_type|default(posting_types|keys|first)),
null, null, null, 'forum__post__dropdown'
) }}
{% endif %}
{{ input_checkbox(
'post[signature]',
'Display Signature',
posting_defaults.signature is not null
? posting_defaults.signature : (
posting_post.post_display_signature is defined
? posting_post.post_display_signature
: true
)
) }}
</div>
<div class="forum__post__buttons">
<button class="input__button">Submit</button>
</div>
</div>
</div>
</div>
</form>
{% endblock %}