summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-04 20:14:26 -0700
committerFrédéric Guillot <fred@kanboard.net>2014-09-04 20:14:26 -0700
commit954bed954f6c81cbcdb217966dcc9e008e7dd149 (patch)
tree3a3b54ed309a151476f2a0e77bbf35baaa078765 /app/Controller
parent749136361e6eedbc868778db17bdc67aa0f3b677 (diff)
Task move position refactoring
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Board.php34
1 files changed, 19 insertions, 15 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index e2c10f58..4724cae5 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -396,27 +396,31 @@ class Board extends Base
*/
public function save()
{
- if ($this->request->isAjax()) {
+ $project_id = $this->request->getIntegerParam('project_id');
- $project_id = $this->request->getIntegerParam('project_id');
- $values = $this->request->getValues();
+ if ($project_id > 0 && $this->request->isAjax()) {
- if ($project_id > 0 && ! $this->project->isUserAllowed($project_id, $this->acl->getUserId())) {
- $this->response->text('Not Authorized', 401);
+ if (! $this->project->isUserAllowed($project_id, $this->acl->getUserId())) {
+ $this->response->status(401);
}
- if (isset($values['positions'])) {
- $this->board->saveTasksPosition($values['positions'], $values['selected_task_id']);
+ $values = $this->request->getValues();
+
+ if ($this->task->movePosition($project_id, $values['task_id'], $values['column_id'], $values['position'])) {
+
+ $this->response->html(
+ $this->template->load('board_show', array(
+ 'current_project_id' => $project_id,
+ 'board' => $this->board->get($project_id),
+ 'categories' => $this->category->getList($project_id, false),
+ )),
+ 201
+ );
}
+ else {
- $this->response->html(
- $this->template->load('board_show', array(
- 'current_project_id' => $project_id,
- 'board' => $this->board->get($project_id),
- 'categories' => $this->category->getList($project_id, false),
- )),
- 201
- );
+ $this->response->status(400);
+ }
}
else {
$this->response->status(401);