Move tasks Gantt chart

This commit is contained in:
Frederic Guillot
2015-08-26 22:47:31 -04:00
parent bd023430c8
commit 05fb655347
17 changed files with 63 additions and 70 deletions

View File

@@ -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()),
)));
}

View File

@@ -86,38 +86,6 @@ class TaskFilter extends Base
return $this;
}
/**
* 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
*
@@ -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'])),

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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')) ?>

View File

@@ -14,10 +14,6 @@
<i class="fa fa-line-chart fa-fw"></i>
<?= $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'])) ?>

View File

@@ -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) ?>

View File

@@ -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'));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -17,6 +17,7 @@
display: inline;
}
.menu-inline li.active a,
.views li.active a {
font-weight: bold;
color: #000;

View File

@@ -30,6 +30,7 @@ div.ganttview-hzheader-month {
height: 20px;
border-right: 1px solid #d0d0d0;
line-height: 20px;
overflow: hidden;
}
div.ganttview-hzheader-day {

View File

@@ -92,12 +92,17 @@ nav .active a {
display: inline-block;
}
.menu-inline li,
.page-header li {
display: inline;
padding-right: 10px;
font-size: 0.95em;
}
.menu-inline {
margin-bottom: 5px;
}
@media only screen and (max-width: 640px) {
.page-header-mobile li {

View File

@@ -301,3 +301,8 @@ span.task-board-date-overdue {
.task-show-start-link:focus {
color: red;
}
.flag-milestone {
color: green;
}

File diff suppressed because one or more lines are too long

View File

@@ -32,6 +32,8 @@ Search.prototype.listen = function() {
};
Search.prototype.keyboardShortcuts = function() {
var self = this;
// Switch view mode for projects: go to the board
Mousetrap.bind("v b", function(e) {
var link = $(".view-board");
@@ -59,6 +61,15 @@ Search.prototype.keyboardShortcuts = function() {
}
});
// Switch view mode for projects: go to the gantt chart
Mousetrap.bind("v g", function(e) {
var link = $(".view-gantt");
if (link.length) {
window.location = link.attr('href');
}
});
// Focus to the search field
Mousetrap.bind("f", function(e) {
e.preventDefault();
@@ -68,5 +79,18 @@ Search.prototype.keyboardShortcuts = function() {
input.focus();
}
});
// Reset to the search field
Mousetrap.bind("r", function(e) {
e.preventDefault();
$("#form-search").val("status:open");
if ($('#board').length) {
self.app.board.reloadFilters("status:open");
}
else {
$("form.search").submit();
}
});
};