summaryrefslogtreecommitdiff
path: root/app/Controller/Gantt.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-15 18:31:47 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-15 18:31:47 -0400
commit67b836164997527b91452b19adbcb8aa3c5decf1 (patch)
treeb5876d311912e97b0592c7e208639f7b52813a75 /app/Controller/Gantt.php
parent108e867605dbc7ece4cbcbecc89a674e9c154a9b (diff)
Refactoring: added controlled middleware and changed response class
Diffstat (limited to 'app/Controller/Gantt.php')
-rw-r--r--app/Controller/Gantt.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php
index 5e9ad55e..d062b2fe 100644
--- a/app/Controller/Gantt.php
+++ b/app/Controller/Gantt.php
@@ -17,7 +17,7 @@ use Kanboard\Model\Project as ProjectModel;
* @package controller
* @author Frederic Guillot
*/
-class Gantt extends Base
+class Gantt extends BaseController
{
/**
* Show Gantt chart for all projects
@@ -53,9 +53,9 @@ class Gantt extends Base
if (! $result) {
$this->response->json(array('message' => 'Unable to save project'), 400);
+ } else {
+ $this->response->json(array('message' => 'OK'), 201);
}
-
- $this->response->json(array('message' => 'OK'), 201);
}
/**
@@ -99,15 +99,18 @@ class Gantt extends Base
if (! $result) {
$this->response->json(array('message' => 'Unable to save task'), 400);
+ } else {
+ $this->response->json(array('message' => 'OK'), 201);
}
-
- $this->response->json(array('message' => 'OK'), 201);
}
/**
* Simplified form to create a new task
*
* @access public
+ * @param array $values
+ * @param array $errors
+ * @throws \Kanboard\Core\Controller\PageNotFoundException
*/
public function task(array $values = array(), array $errors = array())
{
@@ -151,12 +154,12 @@ class Gantt extends Base
if ($task_id !== false) {
$this->flash->success(t('Task created successfully.'));
- $this->response->redirect($this->helper->url->to('gantt', 'project', array('project_id' => $project['id'])));
+ return $this->response->redirect($this->helper->url->to('gantt', 'project', array('project_id' => $project['id'])));
} else {
$this->flash->failure(t('Unable to create your task.'));
}
}
- $this->task($values, $errors);
+ return $this->task($values, $errors);
}
}