diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-02-11 17:22:10 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-02-11 17:22:10 -0500 |
commit | 8bf054a480ecc2d31b857cb27bd6256f1efdd74c (patch) | |
tree | 390065e6c102bc3e8d5dcf5b5e6d7174e5b26da2 /app/Controller/CommentController.php | |
parent | 28052edb22cb0a65d3ad81c7654a0673de82e1ac (diff) |
Open comments in board view with a modal dialog instead of tooltip
Diffstat (limited to 'app/Controller/CommentController.php')
-rw-r--r-- | app/Controller/CommentController.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/app/Controller/CommentController.php b/app/Controller/CommentController.php index 526bd2bf..9a89103e 100644 --- a/app/Controller/CommentController.php +++ b/app/Controller/CommentController.php @@ -4,7 +4,6 @@ namespace Kanboard\Controller; use Kanboard\Core\Controller\AccessForbiddenException; use Kanboard\Core\Controller\PageNotFoundException; -use Kanboard\Model\UserMetadataModel; /** * Comment Controller @@ -17,12 +16,12 @@ class CommentController extends BaseController /** * Get the current comment * - * @access private + * @access protected * @return array * @throws PageNotFoundException * @throws AccessForbiddenException */ - private function getComment() + protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); @@ -77,6 +76,8 @@ class CommentController extends BaseController { $task = $this->getTask(); $values = $this->request->getValues(); + $values['task_id'] = $task['id']; + $values['user_id'] = $this->userSession->getId(); list($valid, $errors) = $this->commentValidator->validateCreation($values); @@ -118,7 +119,6 @@ class CommentController extends BaseController 'errors' => $errors, 'comment' => $comment, 'task' => $task, - 'title' => t('Edit a comment') ))); } @@ -142,10 +142,11 @@ class CommentController extends BaseController $this->flash->failure(t('Unable to update your comment.')); } - return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); + return; } - return $this->edit($values, $errors); + $this->edit($values, $errors); } /** @@ -182,7 +183,7 @@ class CommentController extends BaseController $this->flash->failure(t('Unable to remove this comment.')); } - $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); + $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments'), true); } /** @@ -193,11 +194,7 @@ class CommentController extends BaseController public function toggleSorting() { $task = $this->getTask(); - - $oldDirection = $this->userMetadataCacheDecorator->get(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, 'ASC'); - $newDirection = $oldDirection === 'ASC' ? 'DESC' : 'ASC'; - - $this->userMetadataCacheDecorator->set(UserMetadataModel::KEY_COMMENT_SORTING_DIRECTION, $newDirection); + $this->helper->comment->toggleSorting(); $this->response->redirect($this->helper->url->to( 'TaskViewController', |