Add comments sorting

This commit is contained in:
Frederic Guillot
2015-10-11 18:21:54 -04:00
parent c77c9443e9
commit ffe615d201
10 changed files with 79 additions and 14 deletions

View File

@@ -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'));
}
}