summaryrefslogtreecommitdiff
path: root/app/Template/tasklink/show.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-14 16:11:13 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-14 16:11:13 -0500
commitf7e4c3928aba9cb7f5222cb4af67846312bbb435 (patch)
tree78f5854a0bdc538c977bad718a11d605a4caaca6 /app/Template/tasklink/show.php
parent364382b1b58db8bf1bd2c8866e21c869a7a5d6d0 (diff)
Refactoring/simplification of the pull-request about links
Diffstat (limited to 'app/Template/tasklink/show.php')
-rw-r--r--app/Template/tasklink/show.php93
1 files changed, 33 insertions, 60 deletions
diff --git a/app/Template/tasklink/show.php b/app/Template/tasklink/show.php
index ac49d070..ca4e4383 100644
--- a/app/Template/tasklink/show.php
+++ b/app/Template/tasklink/show.php
@@ -1,68 +1,41 @@
<?php if (! empty($links)): ?>
-<aside id="links" class="task-show-section">
- <div class="page-header">
- <h2><?= t('Links') ?></h2>
- </div>
-
- <table class="link-table">
- <tr>
- <th><?= t('Label') ?></th>
- <th width="70%"><?= t('Task') ?></th>
- <?php if (! isset($not_editable)): ?>
- <th><?= t('Actions') ?></th>
- <?php endif ?>
- </tr>
- <?php $previous_link = null;
- foreach ($links as $link): ?>
- <tr>
+<div class="page-header">
+ <h2><?= t('Links') ?></h2>
+</div>
+<table class="table-fixed" id="links">
+ <tr>
+ <th class="column-30"><?= t('Label') ?></th>
+ <th class="column-60"><?= t('Task') ?></th>
+ <?php if (! isset($not_editable)): ?>
+ <th><?= t('Action') ?></th>
+ <?php endif ?>
+ </tr>
+ <?php foreach ($links as $link): ?>
+ <tr>
+ <td><?= t('This task') ?> <strong><?= t($link['label']) ?></strong></td>
+ <?php if (! isset($not_editable)): ?>
<td>
- <?php if (null == $previous_link || $previous_link != $link['label']):
- $previous_link = $link['label']; ?>
- <?= t($this->e($link['label'])) ?>
- <?php endif ?>
+ <?= $this->a(
+ $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'
+ ) ?>
</td>
<td>
- <?php if (0 == $link['task_inverse_is_active']): ?><span class="task-closed"><?php endif ?>
- <?= $this->e($link['task_inverse_category']) ?>
- <?php if (! isset($not_editable)): ?>
- <?= $this->a('#'.$this->e($link['task_inverse_id']).' - '.trim($this->e($link['task_inverse_title'])), 'task', 'show', array('task_id' => $link['task_inverse_id'], 'project_id' => $link['task_inverse_project_id'])) ?>
- <?php else: ?>
- <?= $this->a('#'.$this->e($link['task_inverse_id']).' - '.trim($this->e($link['task_inverse_title'])), 'task', 'readonly', array('task_id' => $link['task_inverse_id'], 'project_id' => $link['task_inverse_project_id'], 'token' => $project['token'])) ?>
- <?php endif ?>
- <?php if (0 == $link['task_inverse_is_active']): ?></span><?php endif ?>
+ <?= $this->a(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</td>
- <?php if (! isset($not_editable)): ?>
+ <?php else: ?>
<td>
- <ul>
- <li><?= $this->a(t('Edit'), 'tasklink', 'edit', array('task_id' => $task['id'], 'link_id' => $link['id'], 'project_id' => $task['project_id'])) ?></li>
- <li><?= $this->a(t('Remove'), 'tasklink', 'confirm', array('task_id' => $task['id'], 'link_id' => $link['id'], 'project_id' => $task['project_id'])) ?></li>
- </ul>
+ <?= $this->a(
+ $this->e('#'.$link['task_id'].' - '.$link['title']),
+ 'task', 'readonly', array('task_id' => $link['task_id'], 'token' => $project['token']),
+ false,
+ $link['is_active'] ? '' : 'task-link-closed'
+ ) ?>
</td>
- <?php endif ?>
- </tr>
- <?php endforeach ?>
- </table>
-
- <?php if (! isset($not_editable) && !empty($link_list)): ?>
- <form method="post" action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
- <?= $this->formCsrf() ?>
- <?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?>
- #<?= $this->e($task['id']) ?>
- &#160;
- <?= $this->formSelect('link_label_id', $link_list, array(), array(), 'required autofocus') ?>
- &#160;
- #<?= $this->formNumeric('task_inverse_id', array(), array(), array('required', 'placeholder="'.t('Task id').'"', 'title="'.t('Linked task id').'"', 'list="task_inverse_ids"')) ?>
- <?php if (!empty($task_list)): ?>
- <datalist id="task_inverse_ids">
- <select>
- <?php foreach ($task_list as $task_inverse_id => $task_inverse_title): ?>
- <option value="<?= $task_inverse_id ?>">#<?= $task_inverse_id.' '.$task_inverse_title ?></option>
- <?php endforeach ?>
- </select>
- </datalist>
<?php endif ?>
- <input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/>
- </form>
- <?php endif ?>
-</aside>
-<?php endif ?>
+ </tr>
+ <?php endforeach ?>
+</table>
+<?php endif ?> \ No newline at end of file