Enhance task link view to mimic the subtask view
This commit is contained in:
@@ -42,6 +42,7 @@ class Tasklink extends Base
|
||||
'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
|
||||
'task' => $task,
|
||||
'project' => $project,
|
||||
'link_label_list' => $this->link->getList(0, false),
|
||||
'editable' => true,
|
||||
'is_public' => false,
|
||||
'show_title' => true,
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
'is_public' => true,
|
||||
)) ?>
|
||||
|
||||
<?= $this->render('subtask/show', array(
|
||||
'task' => $task,
|
||||
'subtasks' => $subtasks,
|
||||
'editable' => false
|
||||
)) ?>
|
||||
|
||||
<?= $this->render('tasklink/show', array(
|
||||
'task' => $task,
|
||||
'links' => $links,
|
||||
@@ -18,12 +24,6 @@
|
||||
'is_public' => true,
|
||||
)) ?>
|
||||
|
||||
<?= $this->render('subtask/show', array(
|
||||
'task' => $task,
|
||||
'subtasks' => $subtasks,
|
||||
'editable' => false
|
||||
)) ?>
|
||||
|
||||
<?= $this->render('task/comments', array(
|
||||
'task' => $task,
|
||||
'comments' => $comments,
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<?= $this->render('tasklink/show', array(
|
||||
'task' => $task,
|
||||
'links' => $links,
|
||||
'project' => $project,
|
||||
'link_label_list' => $link_label_list,
|
||||
'editable' => true,
|
||||
'is_public' => false,
|
||||
|
||||
@@ -7,111 +7,31 @@
|
||||
<div class="page-header">
|
||||
<h2><?= t('Internal links') ?></h2>
|
||||
</div>
|
||||
<?php if (empty($links)): ?>
|
||||
<p class="alert"><?= t('There is no internal link for the moment.') ?></p>
|
||||
<?php else: ?>
|
||||
<table id="links" class="table-small table-stripped">
|
||||
<tr>
|
||||
<th class="column-20"><?= t('Label') ?></th>
|
||||
<th class="column-30"><?= t('Task') ?></th>
|
||||
<th class="column-20"><?= t('Project') ?></th>
|
||||
<th><?= t('Column') ?></th>
|
||||
<th><?= t('Assignee') ?></th>
|
||||
<?php if ($editable && $this->user->hasProjectAccess('Tasklink', 'edit', $task['project_id'])): ?>
|
||||
<th class="column-5"><?= t('Action') ?></th>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php foreach ($links as $label => $grouped_links): ?>
|
||||
<?php $hide_td = false ?>
|
||||
<?php foreach ($grouped_links as $link): ?>
|
||||
<tr>
|
||||
<?php if (! $hide_td): ?>
|
||||
<td rowspan="<?= count($grouped_links) ?>"><?= t('This task') ?> <strong><?= t($label) ?></strong></td>
|
||||
<?php $hide_td = true ?>
|
||||
<?php endif ?>
|
||||
|
||||
<td>
|
||||
<?php if ($is_public): ?>
|
||||
<?= $this->url->link(
|
||||
$this->text->e('#'.$link['task_id'].' '.$link['title']),
|
||||
'task',
|
||||
'readonly',
|
||||
array('task_id' => $link['task_id'], 'token' => $project['token']),
|
||||
false,
|
||||
$link['is_active'] ? '' : 'task-link-closed'
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->url->link(
|
||||
$this->text->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 endif ?>
|
||||
<div id="link">
|
||||
|
||||
<br>
|
||||
<?= $this->render('tasklink/table', array('links' => $links, 'task' => $task, 'project' => $project, 'editable' => $editable, 'is_public' => $is_public)) ?>
|
||||
|
||||
<?php if (! empty($link['task_time_spent'])): ?>
|
||||
<strong><?= $this->text->e($link['task_time_spent']).'h' ?></strong> <?= t('spent') ?>
|
||||
<?php endif ?>
|
||||
<?php if ($editable && isset($link_label_list)): ?>
|
||||
<form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off">
|
||||
<?= $this->form->csrf() ?>
|
||||
<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
|
||||
<?= $this->form->hidden('opposite_task_id', array()) ?>
|
||||
<?= $this->form->select('link_id', $link_label_list, array(), array()) ?>
|
||||
<?= $this->form->text(
|
||||
'title',
|
||||
array(),
|
||||
array(),
|
||||
array(
|
||||
'required',
|
||||
'placeholder="'.t('Start to type task title...').'"',
|
||||
'title="'.t('Start to type task title...').'"',
|
||||
'data-dst-field="opposite_task_id"',
|
||||
'data-search-url="'.$this->url->href('TaskHelper', 'autocomplete', array('exclude_task_id' => $task['id'])).'"',
|
||||
),
|
||||
'autocomplete') ?>
|
||||
<input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (! empty($link['task_time_estimated'])): ?>
|
||||
<strong><?= $this->text->e($link['task_time_estimated']).'h' ?></strong> <?= t('estimated') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td><?= $this->text->e($link['project_name']) ?></td>
|
||||
<td><?= $this->text->e($link['column_title']) ?></td>
|
||||
<td>
|
||||
<?php if (! empty($link['task_assignee_username'])): ?>
|
||||
<?php if ($editable): ?>
|
||||
<?= $this->url->link($this->text->e($link['task_assignee_name'] ?: $link['task_assignee_username']), 'user', 'show', array('user_id' => $link['task_assignee_id'])) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->text->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<?php if ($editable && $this->user->hasProjectAccess('Tasklink', 'edit', $task['project_id'])): ?>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
|
||||
<ul>
|
||||
<li><?= $this->url->link(t('Edit'), 'tasklink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
|
||||
<li><?= $this->url->link(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
|
||||
<?php if ($editable && isset($link_label_list)): ?>
|
||||
<form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off">
|
||||
|
||||
<?= $this->form->csrf() ?>
|
||||
<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
|
||||
<?= $this->form->hidden('opposite_task_id', array()) ?>
|
||||
|
||||
<?= $this->form->select('link_id', $link_label_list, array(), array()) ?>
|
||||
|
||||
<?= $this->form->text(
|
||||
'title',
|
||||
array(),
|
||||
array(),
|
||||
array(
|
||||
'required',
|
||||
'placeholder="'.t('Start to type task title...').'"',
|
||||
'title="'.t('Start to type task title...').'"',
|
||||
'data-dst-field="opposite_task_id"',
|
||||
'data-search-url="'.$this->url->href('TaskHelper', 'autocomplete', array('exclude_task_id' => $task['id'])).'"',
|
||||
),
|
||||
'autocomplete') ?>
|
||||
|
||||
<button type="submit" class="btn btn-blue"><?= t('Add') ?></button>
|
||||
</form>
|
||||
<?php endif ?>
|
||||
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
86
app/Template/tasklink/table.php
Normal file
86
app/Template/tasklink/table.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php if (empty($links)): ?>
|
||||
<p class="alert"><?= t('There is no internal link for the moment.') ?></p>
|
||||
<?php else: ?>
|
||||
<table class="tasklinks-table table-stripped">
|
||||
<?php foreach ($links as $label => $grouped_links): ?>
|
||||
<?php $hide_td = false ?>
|
||||
<?php foreach ($grouped_links as $link): ?>
|
||||
<?php if (! $hide_td): ?>
|
||||
<tr>
|
||||
<td class="column-40" colspan="2">
|
||||
<?= t('This task') ?>
|
||||
<strong><?= t($label) ?></strong>
|
||||
<span class="board-column-header-task-count">(<?= count($grouped_links) ?>)</span>
|
||||
</td>
|
||||
<th><?= t('Assignee') ?></th>
|
||||
<th><?= t('Time tracking') ?></th>
|
||||
<?php if ($editable): ?>
|
||||
<th class="column-5"></th>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php $hide_td = true ?>
|
||||
<?php endif ?>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($is_public): ?>
|
||||
<?= $this->url->link(
|
||||
$this->text->e('#'.$link['task_id'].' '.$link['title']),
|
||||
'task',
|
||||
'readonly',
|
||||
array('task_id' => $link['task_id'], 'token' => $project['token']),
|
||||
false,
|
||||
$link['is_active'] ? '' : 'task-link-closed'
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->url->link(
|
||||
$this->text->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 endif ?>
|
||||
|
||||
<?php if ($link['project_id'] != $project['id']): ?>
|
||||
<br>
|
||||
<?= t('Project') ?>
|
||||
<?= $this->text->e($link['project_name']) ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td><?= $this->text->e($link['column_title']) ?></td>
|
||||
<td>
|
||||
<?php if (! empty($link['task_assignee_username'])): ?>
|
||||
<?php if ($editable): ?>
|
||||
<?= $this->url->link($this->text->e($link['task_assignee_name'] ?: $link['task_assignee_username']), 'user', 'show', array('user_id' => $link['task_assignee_id'])) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->text->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (! empty($link['task_time_spent'])): ?>
|
||||
<strong><?= $this->text->e($link['task_time_spent']).'h' ?></strong> <?= t('spent') ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (! empty($link['task_time_estimated'])): ?>
|
||||
<strong><?= $this->text->e($link['task_time_estimated']).'h' ?></strong> <?= t('estimated') ?>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
<?php if ($editable && $this->user->hasProjectAccess('Tasklink', 'edit', $task['project_id'])): ?>
|
||||
<td>
|
||||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
|
||||
<ul>
|
||||
<li><?= $this->url->link(t('Edit'), 'tasklink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
|
||||
<li><?= $this->url->link(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<?php endif ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<?php endif ?>
|
||||
Reference in New Issue
Block a user