Merge pull-request #1737

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

View File

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

View File

@@ -12,6 +12,14 @@ use Kanboard\Core\Base;
*/ */
class Task extends Base class Task extends Base
{ {
/**
* Local cache for project columns
*
* @access private
* @var array
*/
private $columns = array();
public function getColors() public function getColors()
{ {
return $this->color->getList(); return $this->color->getList();
@@ -65,4 +73,13 @@ class Task extends Base
return $html; 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.'.title',
Task::TABLE.'.is_active', Task::TABLE.'.is_active',
Task::TABLE.'.project_id', Task::TABLE.'.project_id',
Task::TABLE.'.column_id',
Task::TABLE.'.time_spent AS task_time_spent', Task::TABLE.'.time_spent AS task_time_spent',
Task::TABLE.'.time_estimated AS task_time_estimated', Task::TABLE.'.time_estimated AS task_time_estimated',
Task::TABLE.'.owner_id AS task_assignee_id', Task::TABLE.'.owner_id AS task_assignee_id',

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -76,3 +76,22 @@ div.ui-tooltip {
.ui-tooltip ul { .ui-tooltip ul {
margin-left: 20px; 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;
}