2022-09-13 13:14:49 +00:00
{% extends 'forum/master.twig' %}
{% from 'macros.twig' import avatar %}
{% from 'forum/macros.twig' import forum_header %}
2024-01-30 23:47:02 +00:00
{% from '_layout/input.twig' import input_hidden , input_csrf , input_text , input_select , input_checkbox %}
2022-09-13 13:14:49 +00:00
{% set title = 'Posting' %}
{% set is_reply = posting_topic is defined %}
2023-08-28 01:17:34 +00:00
{% set is_opening = not is_reply or posting_post .isOriginalPost | default ( false ) %}
2022-09-13 13:14:49 +00:00
{% block content %}
2023-03-09 21:05:37 +00:00
<form method="post" action=" {{ url ( 'forum-' ~ ( is_reply ? 'post' : 'topic' ) ~ '-create' ) }} " class="js-forum-posting">
2023-08-28 01:17:34 +00:00
{{ input_hidden ( 'post[' ~ ( is_reply ? 'topic' : 'forum' ) ~ ']' , is_reply ? posting_topic .id : posting_forum .id ) }}
2022-09-13 13:14:49 +00:00
{{ input_hidden ( 'post[mode]' , posting_mode ) }}
{{ input_csrf ( ) }}
{{ forum_header (
is_reply and not is_opening
2023-08-28 01:17:34 +00:00
? posting_topic.title
2022-09-13 13:14:49 +00:00
: input_text(
'post[title]',
'forum__header__input',
2023-08-28 01:17:34 +00:00
posting_defaults.title|default(posting_topic.title|default('')),
2022-09-13 13:14:49 +00:00
'text',
'Enter your title here...'
),
posting_breadcrumbs,
false,
is_reply and not is_opening
2023-08-28 01:17:34 +00:00
? url('forum-topic', { 'topic': posting_topic.id})
2022-09-13 13:14:49 +00:00
: ''
) }}
{% if posting_post is defined %}
2023-08-28 01:17:34 +00:00
{{ input_hidden ( 'post[id]' , posting_post .info .id ) }}
2022-09-13 13:14:49 +00:00
{% 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 %}
2023-08-31 14:55:39 +00:00
<div class="container forum__post" style="--accent-colour: {{ posting_post .colour | default ( posting_user_colour ) }} ">
2022-09-13 13:14:49 +00:00
<div class="forum__post__info">
<div class="forum__post__info__background"></div>
<div class="forum__post__info__content">
2023-08-28 01:17:34 +00:00
<span class="forum__post__avatar"> {{ avatar ( posting_post .user .id | default ( posting_user .id ) , 1 2 0 , posting_post .user .name | default ( posting_user .name ) ) }} </span>
2022-09-13 13:14:49 +00:00
2023-08-28 01:17:34 +00:00
<span class="forum__post__username"> {{ posting_post .user .name | default ( posting_user .name ) }} </span>
2022-09-13 13:14:49 +00:00
<div class="forum__post__icons">
2023-08-28 01:17:34 +00:00
<div class="flag flag-- {{ posting_post .user .countryCode | default ( posting_user .countryCode ) | lower }} " title=" {{ posting_post .user .countryCode | default ( posting_user .countryCode ) | country_name }} "></div>
<div class="forum__post__posts-count"> {{ posting_post .postsCount | default ( posting_user_posts_count ) | number_format }} posts</div>
2022-09-13 13:14:49 +00:00
</div>
<div class="forum__post__joined">
2023-08-28 01:17:34 +00:00
joined <time datetime=" {{ posting_post .user .createdTime | default ( posting_user .createdTime ) | date ( 'c' ) }} " title=" {{ posting_post .user .createdTime | default ( posting_user .createdTime ) | date ( 'r' ) }} "> {{ posting_post .user .createdTime | default ( posting_user .createdTime ) | time_format }} </time>
2022-09-13 13:14:49 +00:00
</div>
</div>
</div>
<div class="forum__post__content">
<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>
2023-08-28 01:17:34 +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 .info .body | default ( '' ) ) }} </textarea>
2022-09-13 13:14:49 +00:00
<div class="forum__post__text js-forum-posting-preview" hidden></div>
2024-01-30 23:47:02 +00:00
<div class="forum__post__actions js-forum-posting-actions"></div>
2022-09-13 13:14:49 +00:00
<div class="forum__post__options">
<div class="forum__post__settings">
{{ input_select (
'post[parser]',
constant('\\Misuzu\\Parsers\\Parser::NAMES'),
2023-08-28 01:17:34 +00:00
posting_defaults.parser|default(posting_post.info.parser|default(posting_user_preferred_parser)),
2022-09-13 13:14:49 +00:00
null, null, false, 'forum__post__dropdown js-forum-posting-parser'
) }}
{% if is_opening and posting_types | length > 1 %}
2023-08-28 01:17:34 +00:00
<select class="input__select forum__post__dropdown" name="post[type]">
{% for type_name , type_title in posting_types %}
2023-08-28 01:41:13 +00:00
<option value=" {{ type_name }} " {% if type_name == posting_topic .typeString | default ( 'discussion' ) %} selected {% endif %} > {{ type_title }} </option>
2023-08-28 01:17:34 +00:00
{% endfor %}
</select>
2022-09-13 13:14:49 +00:00
{% endif %}
{{ input_checkbox (
'post[signature]',
'Display Signature',
posting_defaults.signature is not null
? posting_defaults.signature : (
2023-08-28 01:17:34 +00:00
posting_post.info.shouldDisplaySignature is defined
? posting_post.info.shouldDisplaySignature
2022-09-13 13:14:49 +00:00
: true
)
) }}
</div>
<div class="forum__post__buttons js-forum-posting-buttons">
2024-01-25 00:12:53 +00:00
<button class="input__button" onclick="MszForumEditorAllowClose = true;">Submit</button>
2022-09-13 13:14:49 +00:00
</div>
</div>
</div>
</div>
</form>
2023-03-09 21:05:37 +00:00
2023-08-31 21:33:34 +00:00
{% if globals .eeprom_path is not empty and globals .eeprom_app is not empty %}
2023-03-09 21:05:37 +00:00
<script type="text/javascript">
2023-08-31 21:33:34 +00:00
const peepPath = ' {{ globals .eeprom_path }} ', peepApp = ' {{ globals .eeprom_app }} ';
2023-03-09 21:05:37 +00:00
</script>
{% endif %}
2022-09-13 13:14:49 +00:00
{% endblock %}