Add the possibility to change the assignee directly from the board

This commit is contained in:
Frédéric Guillot
2014-02-23 21:20:25 -05:00
parent 50051e776f
commit 4b7a72e931
6 changed files with 101 additions and 10 deletions

View File

@@ -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()