diff options
author | Frédéric Guillot <contact@fredericguillot.com> | 2014-02-23 21:20:25 -0500 |
---|---|---|
committer | Frédéric Guillot <contact@fredericguillot.com> | 2014-02-23 21:20:25 -0500 |
commit | 4b7a72e931a52753855c8993c65ec8a017555f72 (patch) | |
tree | 20dfc9e82dc3f2026bc14e9538a5df668ffec201 /controllers | |
parent | 50051e776f9183471570f2688d0a85f92b309a3c (diff) |
Add the possibility to change the assignee directly from the board
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/board.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/controllers/board.php b/controllers/board.php index e8b161e7..832ab60f 100644 --- a/controllers/board.php +++ b/controllers/board.php @@ -4,6 +4,41 @@ namespace Controller; class Board extends Base { + // Change a task assignee directly from the board + public function assign() + { + $task = $this->task->getById($this->request->getIntegerParam('task_id')); + $project = $this->project->get($task['project_id']); + $projects = $this->project->getListByStatus(\Model\Project::ACTIVE); + + $this->response->html($this->template->layout('board_assign', array( + 'errors' => array(), + 'values' => $task, + 'users_list' => $this->user->getList(), + 'projects' => $projects, + 'current_project_id' => $project['id'], + 'current_project_name' => $project['name'], + 'menu' => 'boards', + 'title' => t('Change assignee').' - '.$task['title'], + ))); + } + + // Validate an assignee change + public function assignTask() + { + $values = $this->request->getValues(); + list($valid,) = $this->task->validateAssigneeModification($values); + + if ($valid && $this->task->update($values)) { + $this->session->flash(t('Task updated successfully.')); + } + else { + $this->session->flashError(t('Unable to update your task.')); + } + + $this->response->redirect('?controller=board&action=show&project_id='.$values['project_id']); + } + // Display the public version of a board // Access checked by a simple token, no user login, read only, auto-refresh public function readonly() |