Sort columns by due date

This commit is contained in:
Craig Crosby 2019-07-02 22:52:22 -04:00 committed by fguillot
parent efed94b23d
commit 48acf99fd1
35 changed files with 90 additions and 0 deletions

View File

@ -29,6 +29,9 @@ class TaskReorderController extends BaseController
case 'assignee':
$this->taskReorderModel->reorderByAssignee($project['id'], $swimlaneID, $columnID, $direction);
break;
case 'due-date':
$this->taskReorderModel->reorderByDueDate($project['id'], $swimlaneID, $columnID, $direction);
break;
}
$this->response->redirect($this->helper->url->to('BoardViewController', 'show', ['project_id' => $project['id']]));

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => 'Sortere denne kolonne efter ansvarlig og prioritet (DESC)',
'Reorder this column by assignee (A-Z)' => 'Sortere denne kolonne efter ansvarlig (A-Z)',
'Reorder this column by assignee (Z-A)' => 'Sortere denne kolonne efter ansvarlig (Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
'%s moved the task #%d "%s" to the project "%s"' => '%s flyttede opgave #%d "%s" til projekt "%s"',
'Task #%d "%s" has been moved to the project "%s"' => 'Opgave #%d "%s" er flyttet til projekt "%s"',
'Move the task to another column when due date is less than a certain number of days' => 'Flytte opgave til anden kolonne når afleveringsdato er mindre end et bestemt antal dage',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => 'Réorganiser cette colonne par assigné et par priorité (DESC)',
'Reorder this column by assignee (A-Z)' => 'Réorganiser cette colonne par assigné (A-Z)',
'Reorder this column by assignee (Z-A)' => 'Réorganiser cette colonne par assigné (Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
'%s moved the task #%d "%s" to the project "%s"' => '%s a déplacé la tâche #%d « %s » vers le projet « %s »',
'Task #%d "%s" has been moved to the project "%s"' => 'La tâche #%d « %s » a été déplacée vers le projet « %s »',
'Move the task to another column when the due date is less than a certain number of days' => 'Déplaçer la tâche dans une autre colonne lorsque la date d\'échéance est inférieure à un certain nombre de jour',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => 'Oszlop átrendezése felelős és prioritás szerint (csökkenő)',
'Reorder this column by assignee (A-Z)' => 'Oszlop átrendezése felelős szerint (A-Z)',
'Reorder this column by assignee (Z-A)' => 'Oszlop átrendezése felelős szerint (Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => 'Ordina questa colonna per assegnatario e per priorità (DESC)',
'Reorder this column by assignee (A-Z)' => 'Ordina questa colonna per assegnatario (ASC)',
'Reorder this column by assignee (Z-A)' => 'Ordina questa colonna per assegnatario (DESC)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => '担当者と優先度で並び替える(降順)',
'Reorder this column by assignee (A-Z)' => '担当者で並び替える(A-Z)',
'Reorder this column by assignee (Z-A)' => '担当者で並び替える(Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => 'Reordenar esta coluna por designado e prioridade (decrescente)',
'Reorder this column by assignee (A-Z)' => 'Reordenar esta coluna por designado (A-Z)',
'Reorder this column by assignee (Z-A)' => 'Reordenar esta coluna por designado (Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
'%s moved the task #%d "%s" to the project "%s"' => '%s moveu a tarefa #%d "%s" para o projeto "%s"',
'Task #%d "%s" has been moved to the project "%s"' => 'Tarefa #%d "%s" foi movida para o projeto "%s"',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => 'Zoradiť stĺpec podľa pridelenia a priority (ZOST)',
'Reorder this column by assignee (A-Z)' => 'Zoradiť stĺpec podľa pridelenia (A-Z)',
'Reorder this column by assignee (Z-A)' => 'Zoradiť stĺpec podľa pridelenia (Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -1398,6 +1398,8 @@ return array(
'Reorder this column by assignee and priority (DESC)' => '按指派和优先级倒序重排',
'Reorder this column by assignee (A-Z)' => '按指派重排(A-Z)',
'Reorder this column by assignee (Z-A)' => '按指派倒序重排(Z-A)',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
'%s moved the task #%d "%s" to the project "%s"' => '%s 已将任务 #%d "%s" 移动到项目"%s" ',
'Task #%d "%s" has been moved to the project "%s"' => '任务 #%d "%s" 已被移动到项目 "%s"',
'Move the task to another column when the due date is less than a certain number of days' => '当任务即将在指定天数内超期时移动到另一栏',

View File

@ -1398,6 +1398,8 @@ return array(
// 'Reorder this column by assignee and priority (DESC)' => '',
// 'Reorder this column by assignee (A-Z)' => '',
// 'Reorder this column by assignee (Z-A)' => '',
// 'Reorder this column by due date (ASC)' => '',
// 'Reorder this column by due date (DESC)' => '',
// '%s moved the task #%d "%s" to the project "%s"' => '',
// 'Task #%d "%s" has been moved to the project "%s"' => '',
// 'Move the task to another column when due date is less than a certain number of days' => '',

View File

@ -61,6 +61,23 @@ class TaskReorderModel extends Base
$this->db->closeTransaction();
}
public function reorderByDueDate($projectID, $swimlaneID, $columnID, $direction)
{
$this->db->startTransaction();
$taskIDs = $this->db->table(TaskModel::TABLE)
->eq('project_id', $projectID)
->eq('swimlane_id', $swimlaneID)
->eq('column_id', $columnID)
->orderBy('date_due', $direction)
->asc('id')
->findAllByColumn('id');
$this->reorderTasks($taskIDs);
$this->db->closeTransaction();
}
protected function reorderTasks(array $taskIDs)
{
$i = 1;

View File

@ -67,6 +67,12 @@
<li>
<?= $this->url->icon('sort-alpha-desc', t('Reorder this column by assignee (Z-A)'), 'TaskReorderController', 'reorderColumn', ['sort' => 'assignee', 'direction' => 'desc', 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']]) ?>
</li>
<li>
<?= $this->url->icon('sort-numeric-asc', t('Reorder this column by due date (ASC)'), 'TaskReorderController', 'reorderColumn', ['sort' => 'due-date', 'direction' => 'asc', 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']]) ?>
</li>
<li>
<?= $this->url->icon('sort-numeric-desc', t('Reorder this column by due date (DESC)'), 'TaskReorderController', 'reorderColumn', ['sort' => 'due-date', 'direction' => 'desc', 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']]) ?>
</li>
<?php endif ?>
<?= $this->hook->render('template:board:column:dropdown', array('swimlane' => $swimlane, 'column' => $column)) ?>