From 9d3074dfd05c361468aacc7aee0344a8a3137c55 Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 22 May 2018 03:26:47 +0200 Subject: [PATCH] heading a different direction instead with this thing, keeping posting.php separate for posting logic tho --- public/forum/posting.php | 6 +---- views/mio/forum/macros.twig | 33 +++++++++++++++++++++++++- views/mio/forum/posting.twig | 45 ++++++++---------------------------- views/mio/forum/topic.twig | 5 ++-- 4 files changed, 46 insertions(+), 43 deletions(-) diff --git a/public/forum/posting.php b/public/forum/posting.php index 3a6cfd6d..65719ef3 100644 --- a/public/forum/posting.php +++ b/public/forum/posting.php @@ -30,7 +30,7 @@ if ($postRequest) { if (!empty($postId)) { $getPost = $db->prepare(' - SELECT `post_id`, `topic_id`, `user_id`, `post_text` + SELECT `post_id`, `topic_id` FROM `msz_forum_posts` WHERE `post_id` = :post_id '); @@ -135,10 +135,6 @@ if (!empty($topic)) { $templating->var('posting_topic', $topic); } -if (!empty($post)) { - $templating->var('posting_quote', $post); -} - echo $templating->render('forum.posting', [ 'posting_breadcrumbs' => $breadcrumbs, 'posting_forum' => $forum, diff --git a/views/mio/forum/macros.twig b/views/mio/forum/macros.twig index f79fbe71..b9230c80 100644 --- a/views/mio/forum/macros.twig +++ b/views/mio/forum/macros.twig @@ -106,7 +106,7 @@ {% macro forum_topic_buttons(topic) %}
- Reply + Reply
{% endmacro %} @@ -254,3 +254,34 @@ {% endmacro %} + +{% macro forum_posting_form(title, target_id, is_reply, element_id) %} + {% set is_reply = is_reply ? true : false %} + +
+
+ {{ title }} +
+ +
+ + + {% if not is_reply %} +
+ +
+ {% endif %} + +
+ +
+ +
+ +
+
+
+{% endmacro %} diff --git a/views/mio/forum/posting.twig b/views/mio/forum/posting.twig index 5e0ddd95..1306c170 100644 --- a/views/mio/forum/posting.twig +++ b/views/mio/forum/posting.twig @@ -1,44 +1,19 @@ {% extends '@mio/forum/master.twig' %} {% from '@mio/macros.twig' import navigation %} +{% from '@mio/forum/macros.twig' import forum_posting_form %} {% 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 %} {{ navigation(posting_breadcrumbs, posting_breadcrumbs|last, true, null, 'left') }} - -
-
- {% 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 %} -
-
- {% if posting_topic is defined %} - - {% else %} - - -
- -
- {% endif %} - -
- -
- -
- -
-
-
- + {{ forum_posting_form(form_title, form_target_id, posting_topic is defined) }} {{ navigation(mio_navigation, '/forum/') }} {% endblock %} diff --git a/views/mio/forum/topic.twig b/views/mio/forum/topic.twig index 0c31fa9e..bb2b4e20 100644 --- a/views/mio/forum/topic.twig +++ b/views/mio/forum/topic.twig @@ -1,6 +1,6 @@ {% extends '@mio/forum/master.twig' %} {% 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 base_url = '/forum/topic.php?t=' ~ topic_info.topic_id %} @@ -22,7 +22,8 @@ {{ ftpagination }} {{ forum_post_listing(topic_posts, topic_info.topic_first_post_id) }} {{ ftpagination }} - {{ ftbuttons }} + + {{ forum_posting_form('Reply', topic_info.topic_id, true, 'reply') }} {{ navigation(mio_navigation, '/forum/') }} {% endblock %}