diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-03-01 18:03:58 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-03-01 18:03:58 -0500 |
commit | 35d99ec5d3e5d18e83537c68831be02d40f36d8e (patch) | |
tree | 35a86751ad752be286c9e908211dacfc5d174e59 /app/Controller | |
parent | da425e4187e5e8e7feb9783c9d75bcaa9fa0c7ec (diff) |
Add subtask position
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Subtask.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index c7ec00d1..385785a1 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -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'); + } } |