Merge pull-request #1737

This commit is contained in:
Frederic Guillot 2016-01-26 20:08:11 -05:00
commit 320c7971f6
6 changed files with 60 additions and 18 deletions

View File

@ -19,7 +19,7 @@ class BoardTooltip extends Base
{
$task = $this->getTask();
$this->response->html($this->template->render('board/tooltip_tasklinks', array(
'links' => $this->taskLink->getAll($task['id']),
'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
'task' => $task,
)));
}

View File

@ -12,6 +12,14 @@ use Kanboard\Core\Base;
*/
class Task extends Base
{
/**
* Local cache for project columns
*
* @access private
* @var array
*/
private $columns = array();
public function getColors()
{
return $this->color->getList();
@ -65,4 +73,13 @@ class Task extends Base
return $html;
}
public function getProgress($task)
{
if (! isset($this->columns[$task['project_id']])) {
$this->columns[$task['project_id']] = $this->board->getColumnsList($task['project_id']);
}
return $this->task->getProgress($task, $this->columns[$task['project_id']]);
}
}

View File

@ -75,6 +75,7 @@ class TaskLink extends Base
Task::TABLE.'.title',
Task::TABLE.'.is_active',
Task::TABLE.'.project_id',
Task::TABLE.'.column_id',
Task::TABLE.'.time_spent AS task_time_spent',
Task::TABLE.'.time_estimated AS task_time_estimated',
Task::TABLE.'.owner_id AS task_assignee_id',

View File

@ -1,19 +1,24 @@
<div class="tooltip-tasklinks">
<ul>
<?php foreach ($links as $link): ?>
<li>
<strong><?= t($link['label']) ?></strong>
[<i><?= $link['project_name'] ?></i>]
<?= $this->url->link(
$this->e('#'.$link['task_id'].' - '.$link['title']),
'task', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']),
false,
$link['is_active'] ? '' : 'task-link-closed'
) ?>
<?php if (! empty($link['task_assignee_username'])): ?>
[<?= $this->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?>]
<?php endif ?>
</li>
<dl>
<?php foreach ($links as $label => $grouped_links): ?>
<dt><strong><?= t($label) ?></strong></dt>
<?php foreach ($grouped_links as $link): ?>
<dd>
<span class="progress"><?= $this->task->getProgress($link).'%' ?></span>
<?= $this->url->link(
$this->e('#'.$link['task_id'].' '.$link['title']),
'task', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']),
false,
$link['is_active'] ? '' : 'task-link-closed'
) ?>
<?php if (! empty($link['task_assignee_username'])): ?>
[<?= $this->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?>]
<?php endif ?>
<?php if ($task['project_id'] != $link['project_id']): ?>
(<i><?= $link['project_name'] ?></i>)
<?php endif ?>
</dd>
<?php endforeach ?>
<?php endforeach ?>
</ul>
</dl>
</div>

File diff suppressed because one or more lines are too long

View File

@ -76,3 +76,22 @@ div.ui-tooltip {
.ui-tooltip ul {
margin-left: 20px;
}
.ui-tooltip dl {
margin: -5px 0 0 0;
padding: 0;
}
.ui-tooltip dt {
margin-top: 5px;
}
.ui-tooltip dd {
margin-left: 0;
}
.ui-tooltip .progress {
display: inline-block;
min-width: 3em;
text-align: right;
}