From 453513da298534702baef8f2416695bfb2ff1a90 Mon Sep 17 00:00:00 2001
From: Frederic Guillot <fred@kanboard.net>
Date: Sun, 27 Nov 2016 18:48:42 -0500
Subject: Make suggest menu appears in comment textareas

---
 app/Controller/CommentController.php | 14 ++++++++++++--
 app/Template/comments/show.php       |  1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

(limited to 'app')

diff --git a/app/Controller/CommentController.php b/app/Controller/CommentController.php
index c61a0602..526bd2bf 100644
--- a/app/Controller/CommentController.php
+++ b/app/Controller/CommentController.php
@@ -48,6 +48,7 @@ class CommentController extends BaseController
      */
     public function create(array $values = array(), array $errors = array())
     {
+        $project = $this->getProject();
         $task = $this->getTask();
 
         if (empty($values)) {
@@ -57,10 +58,13 @@ class CommentController extends BaseController
             );
         }
 
-        $this->response->html($this->template->render('comment/create', array(
+        $values['project_id'] = $task['project_id'];
+
+        $this->response->html($this->helper->layout->task('comment/create', array(
             'values' => $values,
             'errors' => $errors,
             'task' => $task,
+            'project' => $project,
         )));
     }
 
@@ -103,8 +107,14 @@ class CommentController extends BaseController
         $task = $this->getTask();
         $comment = $this->getComment();
 
+        if (empty($values)) {
+            $values = $comment;
+        }
+
+        $values['project_id'] = $task['project_id'];
+
         $this->response->html($this->template->render('comment/edit', array(
-            'values' => empty($values) ? $comment : $values,
+            'values' => $values,
             'errors' => $errors,
             'comment' => $comment,
             'task' => $task,
diff --git a/app/Template/comments/show.php b/app/Template/comments/show.php
index 5c6d8e20..dfc13821 100644
--- a/app/Template/comments/show.php
+++ b/app/Template/comments/show.php
@@ -26,6 +26,7 @@
                 'values' => array(
                     'user_id' => $this->user->getId(),
                     'task_id' => $task['id'],
+                    'project_id' => $task['project_id'],
                 ),
                 'errors' => array(),
                 'task' => $task,
-- 
cgit v1.2.3