diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-10-07 19:21:26 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-10-07 19:21:26 -0400 |
commit | f63984af1a1098f9d3925b5d5f1d0b98fdcf05e2 (patch) | |
tree | f72296b39352dd7a690987f43e250088550cac88 /app/Controller | |
parent | f7fa47fa35cde502317fbc92ca90278541cd628a (diff) |
Allow quickly creating and changing state of subtask (pull-request #312)
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Subtask.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index 63ca6303..da9acbab 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -184,4 +184,26 @@ class Subtask extends Base $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks'); } + + /** + * Change status to the next status: Toto -> In Progress -> Done + * + * @access public + */ + public function toggleStatus() + { + $task = $this->getTask(); + $subtask = $this->getSubtask(); + + $value = array( + 'id' => $subtask['id'], + 'status' => ($subtask['status'] + 1) % 3 + ); + + if (! $this->subTask->update($value)) { + $this->session->flashError(t('Unable to update your sub-task.')); + } + + $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'#subtasks'); + } } |