diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-08-26 22:47:31 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-08-26 22:47:31 -0400 |
commit | 05fb6553471025af8bb090cd812651816c1c59fc (patch) | |
tree | 9c5f5714b680940882023608d38fbe5b36cc9c6d /app | |
parent | bd023430c8b35f655ef031c6c8d4f6f0bdc188f8 (diff) |
Move tasks Gantt chart
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/Gantt.php | 14 | ||||
-rw-r--r-- | app/Model/TaskFilter.php | 34 | ||||
-rw-r--r-- | app/Template/app/filters_helper.php | 2 | ||||
-rw-r--r-- | app/Template/board/task_footer.php | 2 | ||||
-rw-r--r-- | app/Template/config/about.php | 2 | ||||
-rw-r--r-- | app/Template/gantt/project.php | 24 | ||||
-rw-r--r-- | app/Template/project/dropdown.php | 4 | ||||
-rw-r--r-- | app/Template/project/filters.php | 6 | ||||
-rw-r--r-- | app/common.php | 3 |
9 files changed, 24 insertions, 67 deletions
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php index f73501c3..a2d3f363 100644 --- a/app/Controller/Gantt.php +++ b/app/Controller/Gantt.php @@ -56,23 +56,21 @@ class Gantt extends Base */ public function project() { - $project = $this->getProject(); + $params = $this->getProjectFilters('gantt', 'project'); + $filter = $this->taskFilter->search($params['filters']['search'])->filterByProject($params['project']['id']); $sorting = $this->request->getStringParam('sorting', 'board'); - $filter = $this->taskFilter->gantt()->filterByProject($project['id']); if ($sorting === 'date') { - $filter->query->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation'); + $filter->getQuery()->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation'); } else { - $filter->query->asc('column_position')->asc(TaskModel::TABLE.'.position'); + $filter->getQuery()->asc('column_position')->asc(TaskModel::TABLE.'.position'); } - $this->response->html($this->template->layout('gantt/project', array( + $this->response->html($this->template->layout('gantt/project', $params + array( + 'users_list' => $this->projectPermission->getMemberList($params['project']['id'], false), 'sorting' => $sorting, 'tasks' => $filter->toGanttBars(), - 'project' => $project, - 'title' => t('Gantt chart for %s', $project['name']), - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), ))); } diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index d72af68c..89ad9aa4 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -87,38 +87,6 @@ class TaskFilter extends Base } /** - * Prepare filter for Gantt chart - * - * @access public - * @return TaskFilter - */ - public function gantt() - { - $this->query = $this->db->table(Task::TABLE); - $this->query->join(Board::TABLE, 'id', 'column_id', Task::TABLE); - $this->query->join(User::TABLE, 'id', 'owner_id', Task::TABLE); - - $this->query->columns( - Task::TABLE.'.id', - Task::TABLE.'.title', - Task::TABLE.'.project_id', - Task::TABLE.'.column_id', - Task::TABLE.'.color_id', - Task::TABLE.'.date_started', - Task::TABLE.'.date_due', - Task::TABLE.'.date_creation', - Task::TABLE.'.is_active', - Task::TABLE.'.position', - Board::TABLE.'.position AS column_position', - Board::TABLE.'.title AS column_title', - User::TABLE.'.name AS assignee_name', - User::TABLE.'.username AS assignee_username' - ); - - return $this; - } - - /** * Create a new query * * @access public @@ -739,7 +707,7 @@ class TaskFilter extends Base (int) date('n', $end), (int) date('j', $end), ), - 'column_title' => $task['column_title'], + 'column_title' => $task['column_name'], 'assignee' => $task['assignee_name'] ?: $task['assignee_username'], 'progress' => $this->task->getProgress($task, $columns[$task['project_id']]).'%', 'link' => $this->helper->url->href('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), diff --git a/app/Template/app/filters_helper.php b/app/Template/app/filters_helper.php index e5aea82b..b7a0bba6 100644 --- a/app/Template/app/filters_helper.php +++ b/app/Template/app/filters_helper.php @@ -1,7 +1,7 @@ <div class="dropdown filters"> <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Filters') ?></a> <ul> - <li><a href="#" class="filter-helper" data-filter="<?= isset($reset) ? $reset : '' ?>"><?= t('Reset filters') ?></a></li> + <li><a href="#" class="filter-helper" data-filter="<?= isset($reset) ? $reset : '' ?>" title="<?= t('Keyboard shortcut: "%s"', 'r') ?>"><?= t('Reset filters') ?></a></li> <li><a href="#" class="filter-helper" data-filter="status:open assignee:me"><?= t('My tasks') ?></a></li> <li><a href="#" class="filter-helper" data-filter="status:open assignee:me due:tomorrow"><?= t('My tasks due tomorrow') ?></a></li> <li><a href="#" class="filter-helper" data-filter="status:open due:today"><?= t('Tasks due today') ?></a></li> diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php index 2944db06..0fb5ea8d 100644 --- a/app/Template/board/task_footer.php +++ b/app/Template/board/task_footer.php @@ -66,7 +66,7 @@ <?php if ($task['is_milestone'] == 1): ?> <span title="<?= t('Milestone') ?>"> - <i class="fa fa-flag"></i> + <i class="fa fa-flag flag-milestone"></i> </span> <?php endif ?> </div> diff --git a/app/Template/config/about.php b/app/Template/config/about.php index c55233f4..e0652a2f 100644 --- a/app/Template/config/about.php +++ b/app/Template/config/about.php @@ -57,6 +57,7 @@ <li><?= t('Switch to the board view') ?> = <strong>v b</strong></li> <li><?= t('Switch to the calendar view') ?> = <strong>v c</strong></li> <li><?= t('Switch to the list view') ?> = <strong>v l</strong></li> + <li><?= t('Switch to the Gantt chart view') ?> = <strong>v g</strong></li> </ul> <h3><?= t('Board view') ?></h3> <ul> @@ -68,6 +69,7 @@ <ul> <li><?= t('Open board switcher') ?> = <strong>b</strong></li> <li><?= t('Go to the search/filter box') ?> = <strong>f</strong></li> + <li><?= t('Reset the search/filter box') ?> = <strong>r</strong></li> <li><?= t('Close dialog box') ?> = <strong>ESC</strong></li> <li><?= t('Submit a form') ?> = <strong>CTRL+ENTER</strong> <?= t('or') ?> <strong>⌘+ENTER</strong></li> </ul> diff --git a/app/Template/gantt/project.php b/app/Template/gantt/project.php index 7ad859c7..1face3b8 100644 --- a/app/Template/gantt/project.php +++ b/app/Template/gantt/project.php @@ -1,22 +1,12 @@ <section id="main"> - <div class="page-header"> + <?= $this->render('project/filters', array( + 'project' => $project, + 'filters' => $filters, + 'users_list' => $users_list, + )) ?> + + <div class="menu-inline"> <ul> - <li> - <span class="dropdown"> - <span> - <i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('Actions') ?></a> - <ul> - <?= $this->render('project/dropdown', array('project' => $project)) ?> - </ul> - </span> - </span> - </li> - <li> - <i class="fa fa-th fa-fw"></i> - <?= $this->url->link(t('Back to the board'), 'board', 'show', array('project_id' => $project['id'])) ?> - </li> - </ul> - <ul class="views toolbar"> <li <?= $sorting === 'board' ? 'class="active"' : '' ?>> <i class="fa fa-sort-numeric-asc fa-fw"></i> <?= $this->url->link(t('Sort by position'), 'gantt', 'project', array('project_id' => $project['id'], 'sorting' => 'board')) ?> diff --git a/app/Template/project/dropdown.php b/app/Template/project/dropdown.php index 7b599d60..0a53cc05 100644 --- a/app/Template/project/dropdown.php +++ b/app/Template/project/dropdown.php @@ -15,10 +15,6 @@ <?= $this->url->link(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?> </li> <li> - <i class="fa fa-sliders fa-fw"></i> - <?= $this->url->link(t('Gantt chart'), 'gantt', 'project', array('project_id' => $project['id'])) ?> -</li> -<li> <i class="fa fa-pie-chart fa-fw"></i> <?= $this->url->link(t('Budget'), 'budget', 'index', array('project_id' => $project['id'])) ?> </li> diff --git a/app/Template/project/filters.php b/app/Template/project/filters.php index b53e160e..ddbbbcf1 100644 --- a/app/Template/project/filters.php +++ b/app/Template/project/filters.php @@ -38,6 +38,12 @@ <i class="fa fa-list fa-fw"></i> <?= $this->url->link(t('List'), 'listing', 'show', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-listing', t('Keyboard shortcut: "%s"', 'v l')) ?> </li> + <?php if ($this->user->isProjectManagementAllowed($project['id'])): ?> + <li <?= $filters['controller'] === 'gantt' ? 'class="active"' : '' ?>> + <i class="fa fa-sliders fa-fw"></i> + <?= $this->url->link(t('Gantt'), 'gantt', 'project', array('project_id' => $project['id'], 'search' => $filters['search']), false, 'view-gantt', t('Keyboard shortcut: "%s"', 'v g')) ?> + </li> + <?php endif ?> </ul> <form method="get" action="<?= $this->url->dir() ?>" class="search"> <?= $this->form->hidden('controller', $filters) ?> diff --git a/app/common.php b/app/common.php index 8c1074d6..1f1c7273 100644 --- a/app/common.php +++ b/app/common.php @@ -113,18 +113,15 @@ if (ENABLE_URL_REWRITE) { // Board routes $container['router']->addRoute('board/:project_id', 'board', 'show', array('project_id')); $container['router']->addRoute('b/:project_id', 'board', 'show', array('project_id')); - $container['router']->addRoute('board/:project_id/filter/:search', 'board', 'show', array('project_id', 'search')); $container['router']->addRoute('public/board/:token', 'board', 'readonly', array('token')); // Calendar routes $container['router']->addRoute('calendar/:project_id', 'calendar', 'show', array('project_id')); $container['router']->addRoute('c/:project_id', 'calendar', 'show', array('project_id')); - $container['router']->addRoute('calendar/:project_id/:search', 'calendar', 'show', array('project_id', 'search')); // Listing routes $container['router']->addRoute('list/:project_id', 'listing', 'show', array('project_id')); $container['router']->addRoute('l/:project_id', 'listing', 'show', array('project_id')); - $container['router']->addRoute('list/:project_id/:search', 'listing', 'show', array('project_id', 'search')); // Gantt routes $container['router']->addRoute('gantt/:project_id', 'gantt', 'project', array('project_id')); |