Refactoring: added controlled middleware and changed response class

This commit is contained in:
Frederic Guillot
2016-05-15 18:31:47 -04:00
parent 108e867605
commit 67b8361649
105 changed files with 1586 additions and 1147 deletions

View File

@@ -2,13 +2,15 @@
namespace Kanboard\Controller;
use Kanboard\Core\Controller\AccessForbiddenException;
/**
* Column controller
*
* @package controller
* @author Frederic Guillot
*/
class Column extends Base
class Column extends BaseController
{
/**
* Display columns list
@@ -31,6 +33,9 @@ class Column extends Base
* Show form to create a new column
*
* @access public
* @param array $values
* @param array $errors
* @throws \Kanboard\Core\Controller\PageNotFoundException
*/
public function create(array $values = array(), array $errors = array())
{
@@ -69,7 +74,7 @@ class Column extends Base
}
}
$this->create($values, $errors);
return $this->create($values, $errors);
}
/**
@@ -108,13 +113,13 @@ class Column extends Base
if ($valid) {
if ($this->column->update($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
$this->flash->success(t('Board updated successfully.'));
$this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])));
} else {
$this->flash->failure(t('Unable to update this board.'));
}
}
$this->edit($values, $errors);
return $this->edit($values, $errors);
}
/**
@@ -129,10 +134,10 @@ class Column extends Base
if (! empty($values) && isset($values['column_id']) && isset($values['position'])) {
$result = $this->column->changePosition($project['id'], $values['column_id'], $values['position']);
return $this->response->json(array('result' => $result));
$this->response->json(array('result' => $result));
} else {
throw new AccessForbiddenException();
}
$this->forbidden();
}
/**