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