2018-08-15 01:12:58 +00:00
{% extends 'forum/master.twig' %}
2018-12-27 04:25:51 +00:00
{% from 'forum/macros.twig' import forum_header %}
2019-01-18 22:24:37 +00:00
{% from '_layout/input.twig' import input_hidden , input_csrf , input_text , input_button , input_select , input_checkbox %}
2018-05-22 00:54:20 +00:00
{% set title = 'Posting' %}
2018-12-27 04:25:51 +00:00
{% set is_reply = posting_topic is defined %}
2018-12-30 19:51:32 +00:00
{% set is_opening = not is_reply or posting_post .is_opening_post | default ( false ) %}
2018-05-22 01:26:47 +00:00
2018-05-22 00:54:20 +00:00
{% block content %}
2019-02-28 21:52:39 +00:00
<form method="post" action=" {{ url ( 'forum-' ~ ( is_reply ? 'post' : 'topic' ) ~ '-create' ) }} ">
2018-12-27 04:25:51 +00:00
{{ input_hidden ( 'post[' ~ ( is_reply ? 'topic' : 'forum' ) ~ ']' , is_reply ? posting_topic .topic_id : posting_forum .forum_id ) }}
2018-12-30 03:02:35 +00:00
{{ input_hidden ( 'post[mode]' , posting_mode ) }}
2018-12-27 04:25:51 +00:00
{{ input_csrf ( 'forum_post' ) }}
2018-12-30 03:23:04 +00:00
{{ forum_header (
2018-12-30 19:51:32 +00:00
is_reply and not is_opening
2018-12-30 03:23:04 +00:00
? posting_topic.topic_title
: input_text(
'post[title]',
'forum__header__input',
2019-01-01 03:48:48 +00:00
posting_defaults.title|default(posting_topic.topic_title|default('')),
2018-12-30 03:23:04 +00:00
'text',
'Enter your title here...'
),
posting_breadcrumbs,
false,
2018-12-30 19:51:32 +00:00
is_reply and not is_opening
2019-02-28 21:52:39 +00:00
? url('forum-topic', { 'topic': posting_topic.topic_id})
2018-12-30 03:23:04 +00:00
: ''
) }}
2018-12-27 04:25:51 +00:00
2018-12-30 03:02:35 +00:00
{% if posting_post is defined %}
{{ input_hidden ( 'post[id]' , posting_post .post_id ) }}
{% endif %}
2018-12-27 04:25:51 +00:00
{% if posting_notices | length > 0 %}
<div class="warning">
<div class="warning__content">
{% for notice in posting_notices %}
<p> {{ notice }} </p>
{% endfor %}
</div>
</div>
{% endif %}
2019-01-30 09:19:35 +00:00
<div class="container forum__post js-forum-posting" style=" {{ posting_post .poster_colour | default ( current_user .user_colour ) | html_colour ( '--accent-colour' ) }} ">
2018-12-27 04:25:51 +00:00
<div class="forum__post__info">
<div class="forum__post__info__background"></div>
<div class="forum__post__info__content">
2019-03-25 20:11:31 +00:00
<span class="avatar forum__post__avatar" style="background-image:url(' {{ url ( 'user-avatar' , { 'user' : posting_post .poster_id | default ( current_user .user_id ) , 'res' : 2 4 0 } ) }} ');"></span>
2018-12-27 04:25:51 +00:00
2018-12-30 03:02:35 +00:00
<span class="forum__post__username"> {{ posting_post .poster_name | default ( current_user .username ) }} </span>
2018-12-27 04:25:51 +00:00
<div class="forum__post__icons">
2018-12-30 03:02:35 +00:00
<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>
2018-12-27 04:25:51 +00:00
</div>
<div class="forum__post__joined">
2018-12-30 03:02:35 +00:00
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>
2018-12-27 04:25:51 +00:00
</div>
</div>
</div>
<div class="forum__post__content">
2019-01-30 09:19:35 +00:00
<div class="forum__post__details">
<span class="forum__post__mode js-forum-posting-mode">
{% if posting_post is defined %}
Editing
{% elseif is_reply %}
Replying
{% else %}
Creating
{% endif %}
</span>
</div>
2019-04-10 18:43:33 +00:00
<textarea name="post[text]" class="forum__post__text forum__post__text--edit js-forum-posting-text js-ctrl-enter-submit" placeholder="Type your post content here..."> {{ posting_defaults .text | default ( posting_post .post_text | default ( '' ) ) }} </textarea>
2019-01-30 09:19:35 +00:00
<div class="forum__post__text js-forum-posting-preview" hidden></div>
2018-12-27 04:25:51 +00:00
<div class="forum__post__options">
<div class="forum__post__settings">
2019-01-01 03:48:48 +00:00
{{ input_select (
'post[parser]',
constant('MSZ_PARSERS_NAMES'),
2019-01-18 17:08:19 +00:00
posting_defaults.parser|default(posting_post.post_parse|default(posting_info.user_post_parse|default(constant('MSZ_PARSER_BBCODE')))),
2019-01-30 09:19:35 +00:00
null, null, false, 'forum__post__dropdown js-forum-posting-parser'
2019-01-01 03:48:48 +00:00
) }}
2018-12-30 19:51:32 +00:00
{% if is_opening and posting_types | length > 1 %}
2019-01-01 03:48:48 +00:00
{{ 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'
) }}
2018-12-30 19:51:32 +00:00
{% endif %}
2019-01-18 22:24:37 +00:00
{{ 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
)
) }}
2018-12-27 04:25:51 +00:00
</div>
2019-01-30 09:19:35 +00:00
<div class="forum__post__buttons js-forum-posting-buttons">
2018-12-27 04:25:51 +00:00
<button class="input__button">Submit</button>
</div>
</div>
</div>
</div>
</form>
2018-05-22 00:54:20 +00:00
{% endblock %}