Add subtask position

This commit is contained in:
Frederic Guillot
2015-03-01 18:03:58 -05:00
parent da425e4187
commit 35d99ec5d3
8 changed files with 256 additions and 9 deletions

View File

@@ -185,7 +185,7 @@ class Subtask extends Base
if ($redirect === 'board') {
$this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
$this->response->html($this->template->render('board/subtasks', array(
'subtasks' => $this->subtask->getAll($task['id']),
'task' => $task,
@@ -259,4 +259,22 @@ class Subtask extends Base
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
}
}
/**
* Move subtask position
*
* @access public
*/
public function movePosition()
{
$this->checkCSRFParam();
$project_id = $this->request->getIntegerParam('project_id');
$task_id = $this->request->getIntegerParam('task_id');
$subtask_id = $this->request->getIntegerParam('subtask_id');
$direction = $this->request->getStringParam('direction');
$method = $direction === 'up' ? 'moveUp' : 'moveDown';
$this->subtask->$method($task_id, $subtask_id);
$this->response->redirect($this->helper->url('task', 'show', array('project_id' => $project_id, 'task_id' => $task_id)).'#subtasks');
}
}