Add dropdown menu on the board to reorder tasks by ID
This commit is contained in:
parent
87e9a770c8
commit
f945e45ad4
|
|
@ -20,6 +20,9 @@ class TaskReorderController extends BaseController
|
|||
$sort = $this->request->getStringParam('sort');
|
||||
|
||||
switch ($sort) {
|
||||
case 'id':
|
||||
$this->taskReorderModel->reorderByTaskId($project['id'], $swimlaneID, $columnID, $direction);
|
||||
break;
|
||||
case 'priority':
|
||||
$this->taskReorderModel->reorderByPriority($project['id'], $swimlaneID, $columnID, $direction);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,22 @@ use Kanboard\Core\Base;
|
|||
|
||||
class TaskReorderModel extends Base
|
||||
{
|
||||
public function reorderByTaskId($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('id', $direction)
|
||||
->findAllByColumn('id');
|
||||
|
||||
$this->reorderTasks($taskIDs);
|
||||
|
||||
$this->db->closeTransaction();
|
||||
}
|
||||
|
||||
public function reorderByPriority($projectID, $swimlaneID, $columnID, $direction)
|
||||
{
|
||||
$this->db->startTransaction();
|
||||
|
|
|
|||
|
|
@ -48,11 +48,16 @@
|
|||
</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
|
||||
<?php if ($column['nb_tasks'] > 0 && $this->user->hasProjectAccess('TaskModificationController', 'update', $column['project_id'])): ?>
|
||||
<span class="dropdown">
|
||||
<a href="#" class="dropdown-menu"><i class="fa fa-sort"></i></i></a>
|
||||
<ul>
|
||||
<li>
|
||||
<?= $this->url->icon('sort-numeric-asc', t('Reorder this column by id (ASC)'), 'TaskReorderController', 'reorderColumn', ['sort' => 'id', '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 id (DESC)'), 'TaskReorderController', 'reorderColumn', ['sort' => 'id', '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 priority (ASC)'), 'TaskReorderController', 'reorderColumn', ['sort' => 'priority', 'direction' => 'asc', 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id']]) ?>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue