summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2015-01-02 21:11:19 -0500
committerFrédéric Guillot <fred@kanboard.net>2015-01-02 21:11:19 -0500
commit45c95d74fc2115fe4cc7214553c0927d3ce9df8d (patch)
tree5135be8a33752cce4f1b457a5c379e02aaa65038 /app/Controller
parent3076ba22dd8346725b4e1ad757532c00df5b18d9 (diff)
Various fixes and improvements
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Board.php21
-rw-r--r--app/Controller/Task.php4
2 files changed, 6 insertions, 19 deletions
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 128d9215..48f2b518 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -198,11 +198,10 @@ class Board extends Base
*
* @access public
*/
- public function edit()
+ public function edit(array $values = array(), array $errors = array())
{
$project = $this->getProject();
$columns = $this->board->getColumns($project['id']);
- $values = array();
foreach ($columns as $column) {
$values['title['.$column['id'].']'] = $column['title'];
@@ -210,7 +209,7 @@ class Board extends Base
}
$this->response->html($this->projectLayout('board/edit', array(
- 'errors' => array(),
+ 'errors' => $errors,
'values' => $values + array('project_id' => $project['id']),
'columns' => $columns,
'project' => $project,
@@ -249,13 +248,7 @@ class Board extends Base
}
}
- $this->response->html($this->projectLayout('board/edit', array(
- 'errors' => $errors,
- 'values' => $values + array('project_id' => $project['id']),
- 'columns' => $columns,
- 'project' => $project,
- 'title' => t('Edit board')
- )));
+ $this->edit($values, $errors);
}
/**
@@ -287,13 +280,7 @@ class Board extends Base
}
}
- $this->response->html($this->projectLayout('board/edit', array(
- 'errors' => $errors,
- 'values' => $values + $data,
- 'columns' => $columns,
- 'project' => $project,
- 'title' => t('Edit board')
- )));
+ $this->edit($values, $errors);
}
/**
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 77ea60d9..773183fe 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -438,7 +438,7 @@ class Task extends Base
if ($this->taskDuplication->moveToProject($task['id'], $values['project_id'])) {
$this->session->flash(t('Task updated successfully.'));
- $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'&project_id='.$task['project_id']);
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id'].'&project_id='.$values['project_id']);
}
else {
$this->session->flashError(t('Unable to update your task.'));
@@ -477,7 +477,7 @@ class Task extends Base
$task_id = $this->taskDuplication->duplicateToProject($task['id'], $values['project_id']);
if ($task_id) {
$this->session->flash(t('Task created successfully.'));
- $this->response->redirect('?controller=task&action=show&task_id='.$task_id.'&project_id='.$task['project_id']);
+ $this->response->redirect('?controller=task&action=show&task_id='.$task_id.'&project_id='.$values['project_id']);
}
else {
$this->session->flashError(t('Unable to create your task.'));