Add toggle button to show/hide subtasks in task list view

This commit is contained in:
Frederic Guillot
2017-02-26 19:30:02 -05:00
parent 4f325193be
commit f3deb6492a
28 changed files with 257 additions and 89 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace Kanboard\Formatter;
/**
* Class TaskListSubtaskFormatter
*
* @package Kanboard\Formatter
* @author Frederic Guillot
*/
class TaskListSubtaskFormatter extends TaskListFormatter
{
/**
* Apply formatter
*
* @access public
* @return array
*/
public function format()
{
$tasks = parent::format();
$taskIds = array_column($tasks, 'id');
$subtasks = $this->subtaskModel->getAllByTaskIds($taskIds);
$subtasks = array_column_index($subtasks, 'task_id');
array_merge_relation($tasks, $subtasks, 'subtasks', 'id');
return $tasks;
}
}