heading a different direction instead with this thing, keeping posting.php separate for posting logic tho
This commit is contained in:
parent
990a32d8a1
commit
9d3074dfd0
4 changed files with 46 additions and 43 deletions
|
@ -30,7 +30,7 @@ if ($postRequest) {
|
||||||
|
|
||||||
if (!empty($postId)) {
|
if (!empty($postId)) {
|
||||||
$getPost = $db->prepare('
|
$getPost = $db->prepare('
|
||||||
SELECT `post_id`, `topic_id`, `user_id`, `post_text`
|
SELECT `post_id`, `topic_id`
|
||||||
FROM `msz_forum_posts`
|
FROM `msz_forum_posts`
|
||||||
WHERE `post_id` = :post_id
|
WHERE `post_id` = :post_id
|
||||||
');
|
');
|
||||||
|
@ -135,10 +135,6 @@ if (!empty($topic)) {
|
||||||
$templating->var('posting_topic', $topic);
|
$templating->var('posting_topic', $topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($post)) {
|
|
||||||
$templating->var('posting_quote', $post);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $templating->render('forum.posting', [
|
echo $templating->render('forum.posting', [
|
||||||
'posting_breadcrumbs' => $breadcrumbs,
|
'posting_breadcrumbs' => $breadcrumbs,
|
||||||
'posting_forum' => $forum,
|
'posting_forum' => $forum,
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
{% macro forum_topic_buttons(topic) %}
|
{% macro forum_topic_buttons(topic) %}
|
||||||
<div class="forum__actions forum__actions__content">
|
<div class="forum__actions forum__actions__content">
|
||||||
<a href="/forum/posting.php?t={{ topic.topic_id }}" class="input__button forum__actions__button">Reply</a>
|
<a href="#reply" class="input__button forum__actions__button">Reply</a>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
@ -254,3 +254,34 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro forum_posting_form(title, target_id, is_reply, element_id) %}
|
||||||
|
{% set is_reply = is_reply ? true : false %}
|
||||||
|
|
||||||
|
<form
|
||||||
|
class="container forum__posting"
|
||||||
|
method="post"
|
||||||
|
action="/forum/posting.php">
|
||||||
|
<div class="container__title">
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container__content forum__posting__content"{% if element_id is defined %} id="{{ element_id }}"{% endif %}>
|
||||||
|
<input type="hidden" name="post[{{ is_reply ? 'topic' : 'forum' }}]" value="{{ target_id }}">
|
||||||
|
|
||||||
|
{% if not is_reply %}
|
||||||
|
<div class="forum__posting__title">
|
||||||
|
<input class="input__text forum__posting__title__input" type="text" name="post[title]" placeholder="Topic title">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="forum__posting__text">
|
||||||
|
<textarea class="input__textarea forum__posting__text__input" name="post[text]"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="forum__posting__buttons">
|
||||||
|
<button class="input__button">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endmacro %}
|
||||||
|
|
|
@ -1,44 +1,19 @@
|
||||||
{% extends '@mio/forum/master.twig' %}
|
{% extends '@mio/forum/master.twig' %}
|
||||||
{% from '@mio/macros.twig' import navigation %}
|
{% from '@mio/macros.twig' import navigation %}
|
||||||
|
{% from '@mio/forum/macros.twig' import forum_posting_form %}
|
||||||
|
|
||||||
{% set title = 'Posting' %}
|
{% set title = 'Posting' %}
|
||||||
|
|
||||||
|
{% if posting_topic is defined %}
|
||||||
|
{% set form_title = 'Replying » ' ~ posting_topic.topic_title %}
|
||||||
|
{% set form_target_id = posting_topic.topic_id %}
|
||||||
|
{% else %}
|
||||||
|
{% set form_title = 'Creating Topic » ' ~ posting_forum.forum_name %}
|
||||||
|
{% set form_target_id = posting_forum.forum_id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{{ navigation(posting_breadcrumbs, posting_breadcrumbs|last, true, null, 'left') }}
|
{{ navigation(posting_breadcrumbs, posting_breadcrumbs|last, true, null, 'left') }}
|
||||||
|
{{ forum_posting_form(form_title, form_target_id, posting_topic is defined) }}
|
||||||
<form
|
|
||||||
class="container forum__posting"
|
|
||||||
method="post"
|
|
||||||
action="/forum/posting.php">
|
|
||||||
<div class="container__title">
|
|
||||||
{% if posting_quote is defined %}
|
|
||||||
Quoting » {{ posting_topic.topic_title }}
|
|
||||||
{% elseif posting_topic is defined %}
|
|
||||||
Replying » {{ posting_topic.topic_title }}
|
|
||||||
{% else %}
|
|
||||||
Creating Topic » {{ posting_forum.forum_name }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="container__content forum__posting__content">
|
|
||||||
{% if posting_topic is defined %}
|
|
||||||
<input type="hidden" name="post[topic]" value="{{ posting_topic.topic_id }}">
|
|
||||||
{% else %}
|
|
||||||
<input type="hidden" name="post[forum]" value="{{ posting_forum.forum_id }}">
|
|
||||||
|
|
||||||
<div class="forum__posting__title">
|
|
||||||
<input class="input__text forum__posting__title__input" type="text" name="post[title]" placeholder="Topic title">
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="forum__posting__text">
|
|
||||||
<textarea class="input__textarea forum__posting__text__input" name="post[text]">{% if posting_quote is defined %}[quote={{ posting_quote.post_id }}]{{ posting_quote.post_text }}[/quote]{% endif %}</textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="forum__posting__buttons">
|
|
||||||
<button class="input__button">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{{ navigation(mio_navigation, '/forum/') }}
|
{{ navigation(mio_navigation, '/forum/') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends '@mio/forum/master.twig' %}
|
{% extends '@mio/forum/master.twig' %}
|
||||||
{% from '@mio/macros.twig' import navigation, pagination %}
|
{% from '@mio/macros.twig' import navigation, pagination %}
|
||||||
{% from '@mio/forum/macros.twig' import forum_post_listing, forum_topic_buttons %}
|
{% from '@mio/forum/macros.twig' import forum_post_listing, forum_topic_buttons, forum_posting_form %}
|
||||||
|
|
||||||
{% set title = topic_info.topic_title %}
|
{% set title = topic_info.topic_title %}
|
||||||
{% set base_url = '/forum/topic.php?t=' ~ topic_info.topic_id %}
|
{% set base_url = '/forum/topic.php?t=' ~ topic_info.topic_id %}
|
||||||
|
@ -22,7 +22,8 @@
|
||||||
{{ ftpagination }}
|
{{ ftpagination }}
|
||||||
{{ forum_post_listing(topic_posts, topic_info.topic_first_post_id) }}
|
{{ forum_post_listing(topic_posts, topic_info.topic_first_post_id) }}
|
||||||
{{ ftpagination }}
|
{{ ftpagination }}
|
||||||
{{ ftbuttons }}
|
|
||||||
|
{{ forum_posting_form('Reply', topic_info.topic_id, true, 'reply') }}
|
||||||
|
|
||||||
{{ navigation(mio_navigation, '/forum/') }}
|
{{ navigation(mio_navigation, '/forum/') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue