From ffe615d2018bdfb789667715bbde062dd696d320 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 11 Oct 2015 18:21:54 -0400 Subject: Add comments sorting --- app/Controller/Comment.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/Controller/Comment.php') 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')); + } } -- cgit v1.2.3