Allow quickly creating and changing state of subtask (pull-request #312)
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user