From 0dfe48b7fa475aade00a8ccf42e3dba99dfa3702 Mon Sep 17 00:00:00 2001 From: "Dzial Techniczny WMW Projekt s.c" Date: Wed, 8 Apr 2020 14:01:28 +0200 Subject: "My tasks" view grops tasks by project - fixes #107 --- app/Controller/DashboardController.php | 4 +-- app/Core/Base.php | 1 + app/Formatter/TaskListProjectFormatter.php | 30 +++++++++++++++++++ app/Pagination/TaskPagination.php | 15 ++++++++++ app/ServiceProvider/FormatterProvider.php | 1 + app/Template/dashboard/project_tasks.php | 45 ++++++++++++++++++++++++++++ app/Template/task_list/task_details.php | 2 ++ app/Template/task_list/task_project_name.php | 5 ++++ 8 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 app/Formatter/TaskListProjectFormatter.php create mode 100644 app/Template/dashboard/project_tasks.php create mode 100644 app/Template/task_list/task_project_name.php diff --git a/app/Controller/DashboardController.php b/app/Controller/DashboardController.php index 6758381e..320ee4dd 100644 --- a/app/Controller/DashboardController.php +++ b/app/Controller/DashboardController.php @@ -36,9 +36,9 @@ class DashboardController extends BaseController { $user = $this->getUser(); - $this->response->html($this->helper->layout->dashboard('dashboard/tasks', array( + $this->response->html($this->helper->layout->dashboard('dashboard/project_tasks', array( 'title' => t('Tasks overview for %s', $this->helper->user->getFullname($user)), - 'paginator' => $this->taskPagination->getDashboardPaginator($user['id'], 'tasks', 50), + 'paginator' => $this->taskPagination->getDashboardPerProjectPaginator($user['id'], 'tasks', 50), 'user' => $user, ))); } diff --git a/app/Core/Base.php b/app/Core/Base.php index 3535a339..697566da 100644 --- a/app/Core/Base.php +++ b/app/Core/Base.php @@ -77,6 +77,7 @@ use Pimple\Container; * @property \Kanboard\Formatter\TaskAutoCompleteFormatter $taskAutoCompleteFormatter * @property \Kanboard\Formatter\TaskICalFormatter $taskICalFormatter * @property \Kanboard\Formatter\TaskListFormatter $taskListFormatter + * @property \Kanboard\Formatter\TaskListProjectFormatter $taskListProjectFormatter * @property \Kanboard\Formatter\TaskListSubtaskFormatter $taskListSubtaskFormatter * @property \Kanboard\Formatter\TaskListSubtaskAssigneeFormatter $taskListSubtaskAssigneeFormatter * @property \Kanboard\Formatter\TaskSuggestMenuFormatter $taskSuggestMenuFormatter diff --git a/app/Formatter/TaskListProjectFormatter.php b/app/Formatter/TaskListProjectFormatter.php new file mode 100644 index 00000000..109e9a2d --- /dev/null +++ b/app/Formatter/TaskListProjectFormatter.php @@ -0,0 +1,30 @@ +setFormatter($this->taskListFormatter) ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); } + + public function getDashboardPerProjectPaginator($userId, $method, $max) + { + $query = $this->taskFinderModel->getUserQuery($userId); + $this->hook->reference('pagination:dashboard:task:query', $query); + + return $this->paginator + ->setUrl('DashboardController', $method, array('pagination' => 'tasks', 'user_id' => $userId)) + ->setMax($max) + ->setOrder(TaskModel::TABLE.'.project_id, '.TaskModel::TABLE.'.id') + ->setQuery($query) + ->setFormatter($this->taskListProjectFormatter) + ->calculateOnlyIf($this->request->getStringParam('pagination') === 'tasks'); + } + } diff --git a/app/ServiceProvider/FormatterProvider.php b/app/ServiceProvider/FormatterProvider.php index efc85d06..b43d1ae4 100644 --- a/app/ServiceProvider/FormatterProvider.php +++ b/app/ServiceProvider/FormatterProvider.php @@ -31,6 +31,7 @@ class FormatterProvider implements ServiceProviderInterface 'TaskAutoCompleteFormatter', 'TaskICalFormatter', 'TaskListFormatter', + 'TaskListProjectFormatter', 'TaskListSubtaskFormatter', 'TaskListSubtaskAssigneeFormatter', 'TaskSuggestMenuFormatter', diff --git a/app/Template/dashboard/project_tasks.php b/app/Template/dashboard/project_tasks.php new file mode 100644 index 00000000..1577f814 --- /dev/null +++ b/app/Template/dashboard/project_tasks.php @@ -0,0 +1,45 @@ + +isEmpty()): ?> +

+ +
+ render('task_list/header', array( + 'paginator' => $paginator, + )) ?> + + getCollection() as $task): ?> + render('task_list/task_project_name', array( + 'task' => $task + )) ?> +
+ render('task_list/task_title', array( + 'task' => $task, + 'redirect' => 'dashboard-tasks', + 'is_subtask' => FALSE + )) ?> + + render('task_list/task_details', array( + 'task' => $task, + )) ?> + + render('task_list/task_avatars', array( + 'task' => $task, + )) ?> + + render('task_list/task_icons', array( + 'task' => $task, + )) ?> + + render('task_list/task_subtasks', array( + 'task' => $task, + )) ?> + + hook->render('template:dashboard:task:footer', array('task' => $task)) ?> +
+ +
+ + + diff --git a/app/Template/task_list/task_details.php b/app/Template/task_list/task_details.php index 03e1d3eb..5230a8b5 100644 --- a/app/Template/task_list/task_details.php +++ b/app/Template/task_list/task_details.php @@ -1,5 +1,7 @@
+ text->e($task['project_name']) ?> > + text->e($task['swimlane_name']) ?> > text->e($task['column_name']) ?> diff --git a/app/Template/task_list/task_project_name.php b/app/Template/task_list/task_project_name.php new file mode 100644 index 00000000..c4a6095a --- /dev/null +++ b/app/Template/task_list/task_project_name.php @@ -0,0 +1,5 @@ + +

+ +

+ -- cgit v1.2.3