Add toggle button to show/hide subtasks in task list view
This commit is contained in:
@@ -58,7 +58,7 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface
|
||||
->findAll();
|
||||
|
||||
$task_ids = array_column($tasks, 'id');
|
||||
$tags = $this->taskTagModel->getTagsByTasks($task_ids);
|
||||
$tags = $this->taskTagModel->getTagsByTaskIds($task_ids);
|
||||
|
||||
return $this->boardSwimlaneFormatter
|
||||
->withSwimlanes($swimlanes)
|
||||
|
||||
@@ -16,7 +16,7 @@ class SubtaskListFormatter extends BaseFormatter implements FormatterInterface
|
||||
* Apply formatter
|
||||
*
|
||||
* @access public
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function format()
|
||||
{
|
||||
|
||||
@@ -16,13 +16,13 @@ class TaskListFormatter extends BaseFormatter implements FormatterInterface
|
||||
* Apply formatter
|
||||
*
|
||||
* @access public
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public function format()
|
||||
{
|
||||
$tasks = $this->query->findAll();
|
||||
$taskIds = array_column($tasks, 'id');
|
||||
$tags = $this->taskTagModel->getTagsByTasks($taskIds);
|
||||
$tags = $this->taskTagModel->getTagsByTaskIds($taskIds);
|
||||
array_merge_relation($tasks, $tags, 'tags', 'id');
|
||||
|
||||
return $tasks;
|
||||
|
||||
29
app/Formatter/TaskListSubtaskFormatter.php
Normal file
29
app/Formatter/TaskListSubtaskFormatter.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user