diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Board.php | 2 | ||||
-rw-r--r-- | app/Controller/Comment.php | 15 | ||||
-rw-r--r-- | app/Controller/Task.php | 2 |
3 files changed, 17 insertions, 2 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 840db05b..a2cde287 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -195,7 +195,7 @@ class Board extends Base $task = $this->getTask(); $this->response->html($this->template->render('board/tooltip_comments', array( - 'comments' => $this->comment->getAll($task['id']) + 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()) ))); } diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index 81fd7215..cf0af615 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -183,4 +183,19 @@ class Comment extends Base $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comments')); } + + /** + * Toggle comment sorting + * + * @access public + */ + public function toggleSorting() + { + $task = $this->getTask(); + + $order = $this->userSession->getCommentSorting() === 'ASC' ? 'DESC' : 'ASC'; + $this->userSession->setCommentSorting($order); + + $this->response->redirect($this->helper->url->href('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'comments')); + } } diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 0770fcd1..8e577839 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -68,7 +68,7 @@ class Task extends Base 'project' => $this->project->getById($task['project_id']), 'files' => $this->file->getAllDocuments($task['id']), 'images' => $this->file->getAllImages($task['id']), - 'comments' => $this->comment->getAll($task['id']), + 'comments' => $this->comment->getAll($task['id'], $this->userSession->getCommentSorting()), 'subtasks' => $subtasks, 'links' => $this->taskLink->getAllGroupedByLabel($task['id']), 'task' => $task, |