Add the possibility to change the assignee directly from the board
This commit is contained in:
parent
50051e776f
commit
4b7a72e931
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ return array(
|
|||
'Unassigned' => 'Non assigné',
|
||||
'View this task' => 'Visualiser cette tâche',
|
||||
'Remove user' => 'Supprimer un utilisateur',
|
||||
'Do you really want to remove this user: "%s"?' => 'Voulez-vous vraiment supprimer cet utilisateur : "%s" ?',
|
||||
'Do you really want to remove this user: "%s"?' => 'Voulez-vous vraiment supprimer cet utilisateur : « %s » ?',
|
||||
'New user' => 'Ajouter un utilisateur',
|
||||
'All users' => 'Tous les utilisateurs',
|
||||
'Username' => 'Nom d\'utilisateur',
|
||||
|
|
@ -65,22 +65,22 @@ return array(
|
|||
'Disable' => 'Désactiver',
|
||||
'Enable' => 'Activer',
|
||||
'New project' => 'Nouveau projet',
|
||||
'Do you really want to remove this project: "%s"?' => 'Voulez-vous vraiment supprimer ce projet : "%s" ?',
|
||||
'Do you really want to remove this project: "%s"?' => 'Voulez-vous vraiment supprimer ce projet : « %s » ?',
|
||||
'Remove project' => 'Supprimer le projet',
|
||||
'boards' => 'tableaux',
|
||||
'Edit the board for "%s"' => 'Modifier le tableau pour "%s"',
|
||||
'Edit the board for "%s"' => 'Modifier le tableau pour « %s »',
|
||||
'All projects' => 'Tous les projets',
|
||||
'Change columns' => 'Changer les colonnes',
|
||||
'Add a new column' => 'Ajouter une nouvelle colonne',
|
||||
'Title' => 'Titre',
|
||||
'Add Column' => 'Nouvelle colonne',
|
||||
'Project "%s"' => 'Projet "%s"',
|
||||
'Project "%s"' => 'Projet « %s »',
|
||||
'No body assigned' => 'Personne assigné',
|
||||
'Assigned to %s' => 'Assigné à %s',
|
||||
'Remove a column' => 'Supprimer une colonne',
|
||||
'Remove a column from a board' => 'Supprimer une colonne d\'un tableau',
|
||||
'Unable to remove this column.' => 'Impossible de supprimer cette colonne.',
|
||||
'Do you really want to remove this column: "%s"?' => 'Voulez vraiment supprimer cette colonne : "%s" ?',
|
||||
'Do you really want to remove this column: "%s"?' => 'Voulez vraiment supprimer cette colonne : « %s » ?',
|
||||
'This action will REMOVE ALL TASKS associated to this column!' => 'Cette action va supprimer toutes les tâches associées à cette colonne !',
|
||||
'settings' => 'préférences',
|
||||
'Application Settings' => 'Paramètres de l\'application',
|
||||
|
|
@ -95,7 +95,7 @@ return array(
|
|||
'User Settings' => 'Paramètres utilisateur',
|
||||
'My default project:' => 'Mon projet par défaut : ',
|
||||
'Close a task' => 'Fermer une tâche',
|
||||
'Do you really want to close this task: "%s"?' => 'Voulez-vous vraiment fermer cettre tâche : "%s" ?',
|
||||
'Do you really want to close this task: "%s"?' => 'Voulez-vous vraiment fermer cettre tâche : « %s » ?',
|
||||
'Edit a task' => 'Modifier une tâche',
|
||||
'Column' => 'Colonne',
|
||||
'Color' => 'Couleur',
|
||||
|
|
@ -103,7 +103,7 @@ return array(
|
|||
'Create another task' => 'Créer une autre tâche',
|
||||
'New task' => 'Nouvelle tâche',
|
||||
'Open a task' => 'Ouvrir une tâche',
|
||||
'Do you really want to open this task: "%s"?' => 'Voulez-vous vraiment ouvrir cette tâche : "%s" ?',
|
||||
'Do you really want to open this task: "%s"?' => 'Voulez-vous vraiment ouvrir cette tâche : « %s » ?',
|
||||
'Back to the board' => 'Retour au tableau',
|
||||
'Created on %B %e, %G at %k:%M %p' => 'Créé le %e %B %G à %k:%M',
|
||||
'There is no body assigned' => 'Il n\'y a personne d\'assigné à cette tâche',
|
||||
|
|
@ -176,9 +176,11 @@ return array(
|
|||
'No task' => 'Aucune tâche',
|
||||
'completed tasks' => 'tâches terminées',
|
||||
'List of projects' => 'Liste des projets',
|
||||
'Completed tasks for "%s"' => 'Tâches terminées pour "%s"',
|
||||
'Completed tasks for "%s"' => 'Tâches terminées pour « %s »',
|
||||
'%d closed tasks' => '%d tâches terminées',
|
||||
'no task for this project' => 'aucune tâche pour ce projet',
|
||||
'Public link' => 'Accès public',
|
||||
'There is no column in your project!' => 'Il n\'y a aucune colonne dans votre projet !',
|
||||
'Change assignee' => 'Changer la personne assignée',
|
||||
'Change assignee for the task "%s"' => 'Changer la personne assignée pour la tâche « %s »',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -183,5 +183,7 @@ return array(
|
|||
|
||||
/* Missing translations:
|
||||
'There is no column in your project!' => '',
|
||||
'Change assignee' => '',
|
||||
'Change assignee for the task "%s"' => '',
|
||||
*/
|
||||
);
|
||||
|
|
|
|||
|
|
@ -209,4 +209,21 @@ class Task extends Base
|
|||
$v->getErrors()
|
||||
);
|
||||
}
|
||||
|
||||
public function validateAssigneeModification(array $values)
|
||||
{
|
||||
$v = new Validator($values, array(
|
||||
new Validators\Required('id', t('The id is required')),
|
||||
new Validators\Integer('id', t('This value must be an integer')),
|
||||
new Validators\Required('project_id', t('The project is required')),
|
||||
new Validators\Integer('project_id', t('This value must be an integer')),
|
||||
new Validators\Required('owner_id', t('This value is required')),
|
||||
new Validators\Integer('owner_id', t('This value must be an integer')),
|
||||
));
|
||||
|
||||
return array(
|
||||
$v->execute(),
|
||||
$v->getErrors()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<section id="main">
|
||||
|
||||
<div class="page-header board">
|
||||
<h2>
|
||||
<?= t('Project "%s"', $current_project_name) ?>
|
||||
</h2>
|
||||
<ul>
|
||||
<?php foreach ($projects as $project_id => $project_name): ?>
|
||||
<?php if ($project_id != $current_project_id): ?>
|
||||
<li>
|
||||
<a href="?controller=board&action=show&project_id=<?= $project_id ?>"><?= Helper\escape($project_name) ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<h3><?= t('Change assignee for the task "%s"', $values['title']) ?></h3>
|
||||
<form method="post" action="?controller=board&action=assignTask" autocomplete="off">
|
||||
|
||||
<?= Helper\form_hidden('id', $values) ?>
|
||||
<?= Helper\form_hidden('project_id', $values) ?>
|
||||
|
||||
<?= Helper\form_label(t('Assignee'), 'owner_id') ?>
|
||||
<?= Helper\form_select('owner_id', $users_list, $values, $errors) ?><br/>
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
|
||||
<?= t('or') ?> <a href="?controller=board&action=show&project_id=<?= $values['project_id'] ?>"><?= t('cancel') ?></a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
|
@ -46,9 +46,9 @@
|
|||
|
||||
<span class="task-user">
|
||||
<?php if (! empty($task['owner_id'])): ?>
|
||||
<?= t('Assigned to %s', $task['username']) ?>
|
||||
<a href="?controller=board&action=assign&task_id=<?= $task['id'] ?>" title="<?= t('Change assignee') ?>"><?= t('Assigned to %s', $task['username']) ?></a>
|
||||
<?php else: ?>
|
||||
<span class="task-nobody"><?= t('No body assigned') ?></span>
|
||||
<a href="?controller=board&action=assign&task_id=<?= $task['id'] ?>" title="<?= t('Change assignee') ?>" class="task-nobody"><?= t('No body assigned') ?></a>
|
||||
<?php endif ?>
|
||||
</span>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue