diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-02-20 11:24:43 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-02-20 11:24:43 -0500 |
commit | c8c1242c26a11dc2abc7126829d76430612e7107 (patch) | |
tree | 012c7cf8df996b3af570120cfbfc3dd75eb5a13d /app/Controller | |
parent | 2d27c36a71f08bea60a992b051bfb8a2d8bd06b6 (diff) |
Add drag and drop to change column positions
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Column.php | 13 | ||||
-rw-r--r-- | app/Controller/Subtask.php | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/app/Controller/Column.php b/app/Controller/Column.php index 77204164..2e028e0e 100644 --- a/app/Controller/Column.php +++ b/app/Controller/Column.php @@ -117,22 +117,21 @@ class Column extends Base } /** - * Move a column up or down + * Move column position * * @access public */ public function move() { - $this->checkCSRFParam(); $project = $this->getProject(); - $column_id = $this->request->getIntegerParam('column_id'); - $direction = $this->request->getStringParam('direction'); + $values = $this->request->getJson(); - if ($direction === 'up' || $direction === 'down') { - $this->board->{'move'.$direction}($project['id'], $column_id); + if (! empty($values)) { + $result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']); + return $this->response->json(array('result' => $result)); } - $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id']))); + $this->forbidden(); } /** diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php index a0a3eb66..8ca0ce92 100644 --- a/app/Controller/Subtask.php +++ b/app/Controller/Subtask.php @@ -174,7 +174,7 @@ class Subtask extends Base 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)); + return $this->response->json(array('result' => $result)); } $this->forbidden(); |