Split Board model into multiple classes
This commit is contained in:
@@ -18,7 +18,7 @@ class Column extends Base
|
||||
public function index()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$columns = $this->board->getColumns($project['id']);
|
||||
$columns = $this->column->getAll($project['id']);
|
||||
|
||||
$this->response->html($this->helper->layout->project('column/index', array(
|
||||
'columns' => $columns,
|
||||
@@ -35,7 +35,7 @@ class Column extends Base
|
||||
public function create(array $values = array(), array $errors = array())
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$columns = $this->board->getColumnsList($project['id']);
|
||||
$columns = $this->column->getList($project['id']);
|
||||
|
||||
if (empty($values)) {
|
||||
$values = array('project_id' => $project['id']);
|
||||
@@ -62,7 +62,7 @@ class Column extends Base
|
||||
list($valid, $errors) = $this->columnValidator->validateCreation($values);
|
||||
|
||||
if ($valid) {
|
||||
if ($this->board->addColumn($project['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
||||
if ($this->column->create($project['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
||||
$this->flash->success(t('Column created successfully.'));
|
||||
return $this->response->redirect($this->helper->url->to('column', 'index', array('project_id' => $project['id'])), true);
|
||||
} else {
|
||||
@@ -81,7 +81,7 @@ class Column extends Base
|
||||
public function edit(array $values = array(), array $errors = array())
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$column = $this->board->getColumn($this->request->getIntegerParam('column_id'));
|
||||
$column = $this->column->getById($this->request->getIntegerParam('column_id'));
|
||||
|
||||
$this->response->html($this->helper->layout->project('column/edit', array(
|
||||
'errors' => $errors,
|
||||
@@ -105,7 +105,7 @@ class Column extends Base
|
||||
list($valid, $errors) = $this->columnValidator->validateModification($values);
|
||||
|
||||
if ($valid) {
|
||||
if ($this->board->updateColumn($values['id'], $values['title'], $values['task_limit'], $values['description'])) {
|
||||
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'])));
|
||||
} else {
|
||||
@@ -144,7 +144,7 @@ class Column extends Base
|
||||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->helper->layout->project('column/remove', array(
|
||||
'column' => $this->board->getColumn($this->request->getIntegerParam('column_id')),
|
||||
'column' => $this->column->getById($this->request->getIntegerParam('column_id')),
|
||||
'project' => $project,
|
||||
'title' => t('Remove a column from a board')
|
||||
)));
|
||||
@@ -159,9 +159,9 @@ class Column extends Base
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$this->checkCSRFParam();
|
||||
$column = $this->board->getColumn($this->request->getIntegerParam('column_id'));
|
||||
$column_id = $this->request->getIntegerParam('column_id');
|
||||
|
||||
if (! empty($column) && $this->board->removeColumn($column['id'])) {
|
||||
if ($this->column->remove($column_id)) {
|
||||
$this->flash->success(t('Column removed successfully.'));
|
||||
} else {
|
||||
$this->flash->failure(t('Unable to remove this column.'));
|
||||
|
||||
Reference in New Issue
Block a user