diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-02-19 22:59:47 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-02-19 22:59:47 -0500 |
commit | de4519fa2c45ca96d4bf0b9ce288cad600d09854 (patch) | |
tree | 9e66f936c8c82f32332cf74c24ca235dda5cd47b /app/Controller/Subtask.php | |
parent | 270e0835b2f1b6de2c84d2cb1b7596d5babb6c2f (diff) |
Add subtasks drag and drop
Diffstat (limited to 'app/Controller/Subtask.php')
-rw-r--r-- | app/Controller/Subtask.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index f8798906..a0a3eb66 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -23,7 +23,6 @@ class Subtask extends Base 'project' => $this->getProject(), 'subtasks' => $this->subtask->getAll($task['id']), 'editable' => true, - 'redirect' => 'subtask', ))); } @@ -169,15 +168,15 @@ class Subtask extends Base */ 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'; - $redirect = $this->request->getStringParam('redirect', 'task'); + $values = $this->request->getJson(); + + if (! empty($values) && $this->helper->user->hasProjectAccess('Subtask', 'movePosition', $project_id)) { + $result = $this->subtask->changePosition($task_id, $values['subtask_id'], $values['position']); + $this->response->json(array('result' => $result)); + } - $this->subtask->$method($task_id, $subtask_id); - $this->response->redirect($this->helper->url->to($redirect, 'show', array('project_id' => $project_id, 'task_id' => $task_id), 'subtasks')); + $this->forbidden(); } } |