summaryrefslogtreecommitdiff
path: root/app/Controller/ColumnController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/ColumnController.php')
-rw-r--r--app/Controller/ColumnController.php39
1 files changed, 27 insertions, 12 deletions
diff --git a/app/Controller/ColumnController.php b/app/Controller/ColumnController.php
index e3f9bfff..69167976 100644
--- a/app/Controller/ColumnController.php
+++ b/app/Controller/ColumnController.php
@@ -25,7 +25,7 @@ class ColumnController extends BaseController
$this->response->html($this->helper->layout->project('column/index', array(
'columns' => $columns,
'project' => $project,
- 'title' => t('Edit board')
+ 'title' => t('Edit columns')
)));
}
@@ -49,7 +49,6 @@ class ColumnController extends BaseController
'values' => $values,
'errors' => $errors,
'project' => $project,
- 'title' => t('Add a new column')
)));
}
@@ -61,20 +60,29 @@ class ColumnController extends BaseController
public function save()
{
$project = $this->getProject();
- $values = $this->request->getValues();
+ $values = $this->request->getValues() + array('hide_in_dashboard' => 0);
list($valid, $errors) = $this->columnValidator->validateCreation($values);
if ($valid) {
- if ($this->columnModel->create($project['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) {
+ $result = $this->columnModel->create(
+ $project['id'],
+ $values['title'],
+ $values['task_limit'],
+ $values['description'],
+ $values['hide_in_dashboard']
+ );
+
+ if ($result !== false) {
$this->flash->success(t('Column created successfully.'));
- return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
+ $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
+ return;
} else {
$errors['title'] = array(t('Another column with the same name exists in the project'));
}
}
- return $this->create($values, $errors);
+ $this->create($values, $errors);
}
/**
@@ -94,7 +102,6 @@ class ColumnController extends BaseController
'values' => $values ?: $column,
'project' => $project,
'column' => $column,
- 'title' => t('Edit column "%s"', $column['title'])
)));
}
@@ -106,20 +113,29 @@ class ColumnController extends BaseController
public function update()
{
$project = $this->getProject();
- $values = $this->request->getValues();
+ $values = $this->request->getValues() + array('hide_in_dashboard' => 0);
list($valid, $errors) = $this->columnValidator->validateModification($values);
if ($valid) {
- if ($this->columnModel->update($values['id'], $values['title'], $values['task_limit'], $values['description'], $values['hide_in_dashboard']) !== false) {
+ $result = $this->columnModel->update(
+ $values['id'],
+ $values['title'],
+ $values['task_limit'],
+ $values['description'],
+ $values['hide_in_dashboard']
+ );
+
+ if ($result) {
$this->flash->success(t('Board updated successfully.'));
- return $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
+ $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])), true);
+ return;
} else {
$this->flash->failure(t('Unable to update this board.'));
}
}
- return $this->edit($values, $errors);
+ $this->edit($values, $errors);
}
/**
@@ -152,7 +168,6 @@ class ColumnController extends BaseController
$this->response->html($this->helper->layout->project('column/remove', array(
'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')),
'project' => $project,
- 'title' => t('Remove a column from a board')
)));
}