summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/board/tasklinks.php41
-rw-r--r--app/Template/config/sidebar.php2
-rw-r--r--app/Template/link/create.php18
-rw-r--r--app/Template/link/edit.php48
-rw-r--r--app/Template/link/index.php21
-rw-r--r--app/Template/link/remove.php26
-rw-r--r--app/Template/task/public.php12
-rw-r--r--app/Template/task/show.php2
-rw-r--r--app/Template/tasklink/create.php27
-rw-r--r--app/Template/tasklink/edit.php53
-rw-r--r--app/Template/tasklink/remove.php6
-rw-r--r--app/Template/tasklink/show.php93
12 files changed, 136 insertions, 213 deletions
diff --git a/app/Template/board/tasklinks.php b/app/Template/board/tasklinks.php
index d7b64e1d..9c4f52ca 100644
--- a/app/Template/board/tasklinks.php
+++ b/app/Template/board/tasklinks.php
@@ -1,28 +1,15 @@
-<section class="tooltip-tasklinks">
-<div>
-<ul>
-<?php
-$previous_link = null;
-foreach ($links as $link): ?>
- <?php if (null == $previous_link || $previous_link != $link['label']): ?>
- <?php if (null != $previous_link): ?>
- </ul>
+<div class="tooltip-tasklinks">
+ <ul>
+ <?php foreach($links as $link): ?>
+ <li>
+ <strong><?= t($link['label']) ?></strong>
+ <?= $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'
+ ) ?>
</li>
- <?php endif ?>
- <?php $previous_link = $link['label']; ?>
- <li><?= t($this->e($link['label'])) ?>
- <ul>
- <?php endif ?>
- <li<?php if (0 == $link['task_inverse_is_active']): ?> class="task-closed"<?php endif ?>>
- <?= $this->e($link['task_inverse_category']) ?>
- <?= $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'])) ?>
- </li>
-<?php endforeach ?>
- </ul>
- </li>
-</ul>
-</div>
-</section>
+ <?php endforeach ?>
+ </ul>
+</div> \ No newline at end of file
diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php
index a0ec8b36..89f2c203 100644
--- a/app/Template/config/sidebar.php
+++ b/app/Template/config/sidebar.php
@@ -11,7 +11,7 @@
<?= $this->a(t('Board settings'), 'config', 'board') ?>
</li>
<li>
- <?= $this->a(t('Links settings'), 'link', 'index') ?>
+ <?= $this->a(t('Link settings'), 'link', 'index') ?>
</li>
<li>
<?= $this->a(t('Webhooks'), 'config', 'webhook') ?>
diff --git a/app/Template/link/create.php b/app/Template/link/create.php
new file mode 100644
index 00000000..12589574
--- /dev/null
+++ b/app/Template/link/create.php
@@ -0,0 +1,18 @@
+<div class="page-header">
+ <h2><?= t('Add a new link') ?></h2>
+</div>
+
+<form action="<?= $this->u('link', 'save') ?>" method="post" autocomplete="off">
+
+ <?= $this->formCsrf() ?>
+
+ <?= $this->formLabel(t('Label'), 'label') ?>
+ <?= $this->formText('label', $values, $errors, array('required')) ?>
+
+ <?= $this->formLabel(t('Opposite label'), 'opposite_label') ?>
+ <?= $this->formText('opposite_label', $values, $errors) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/link/edit.php b/app/Template/link/edit.php
index 71d4f3ca..d9ce280c 100644
--- a/app/Template/link/edit.php
+++ b/app/Template/link/edit.php
@@ -1,49 +1,21 @@
-<section id="link-edit-section">
-<?php use Model\Link;
-if (! isset($edit)): ?>
- <h3><?= t('Add a new link label') ?></h3>
-<?php else: ?>
<div class="page-header">
- <h2><?= t('Edit the link label') ?></h2>
+ <h2><?= t('Link modification') ?></h2>
</div>
-<?php endif ?>
-<form method="post" action="<?= $this->u('link', isset($edit) ? 'update' : 'save', array('project_id' => $project['id'], 'link_id' => @$values['id'])) ?>" autocomplete="off">
+<form action="<?= $this->u('link', 'update', array('link_id' => $link['id'])) ?>" method="post" autocomplete="off">
+
<?= $this->formCsrf() ?>
+ <?= $this->formHidden('id', $values) ?>
- <?php if (isset($edit)): ?>
- <?= $this->formHidden('link_id', $values) ?>
- <?= $this->formHidden('id[0]', $values[0]) ?>
- <?php if (isset($values[1])): ?>
- <?= $this->formHidden('id[1]', $values[1]) ?>
- <?php endif ?>
- <?php endif ?>
- <?= $this->formHidden('project_id', $values) ?>
+ <?= $this->formLabel(t('Label'), 'label') ?>
+ <?= $this->formText('label', $values, $errors, array('required')) ?>
- <?= $this->formLabel(t('Link Label'), 'label[0]') ?>
- <?= $this->formText('label[0]', $values[0], $errors, array('required', 'autofocus', 'placeholder="'.t('precedes').'"')) ?> &raquo;
-
- <?= $this->formCheckbox('behaviour[0]', t('Bidrectional link label'), Link::BEHAVIOUR_BOTH, (isset($values[0]['behaviour']) && Link::BEHAVIOUR_BOTH == $values[0]['behaviour']), 'behaviour') ?>
+ <?= $this->formLabel(t('Opposite label'), 'opposite_id') ?>
+ <?= $this->formSelect('opposite_id', $labels, $values, $errors) ?>
- <div class="link-inverse-label">
- <?= $this->formLabel(t('Link Inverse Label'), 'label[1]') ?>
- &laquo; <?= $this->formText('label[1]', isset($values[1]) ? $values[1] : $values, $errors, array('placeholder="'.t('follows').'"')) ?>
- </div>
-
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- <?php if (isset($edit)): ?>
<?= t('or') ?>
- <?= $this->a(t('cancel'), 'link', 'index', array('project_id' => $project['id'])) ?>
- <?php endif ?>
- </div>
- <?php if (! isset($edit)): ?>
- <div class="alert alert-info">
- <strong><?= t('Example:') ?></strong>
- <i><?= t('#9 precedes #10') ?></i>
- <?= t('and therefore') ?>
- <i><?= t('#10 follows #9') ?></i>
+ <?= $this->a(t('cancel'), 'link', 'index') ?>
</div>
- <?php endif ?>
-</form>
-</section> \ No newline at end of file
+</form> \ No newline at end of file
diff --git a/app/Template/link/index.php b/app/Template/link/index.php
index 0c19b614..90d1c357 100644
--- a/app/Template/link/index.php
+++ b/app/Template/link/index.php
@@ -1,30 +1,33 @@
<div class="page-header">
<h2><?= t('Link labels') ?></h2>
</div>
-
-<section>
<?php if (! empty($links)): ?>
<table>
<tr>
- <th width="70%"><?= t('Link labels') ?></th>
+ <th class="column-70"><?= t('Link labels') ?></th>
<th><?= t('Actions') ?></th>
</tr>
<?php foreach ($links as $link): ?>
<tr>
- <td><?= t($this->e($link['label'])) ?><?php if (isset($link['label_inverse']) && !empty($link['label_inverse'])): ?> | <?= t($this->e($link['label_inverse'])) ?><?php endif ?></td>
+ <td>
+ <strong><?= t($link['label']) ?></strong>
+
+ <?php if (! empty($link['opposite_label'])): ?>
+ | <?= t($link['opposite_label']) ?>
+ <?php endif ?>
+ </td>
<td>
<ul>
- <?= $this->a(t('Edit'), 'link', 'edit', array('link_id' => $link['link_id'], 'project_id' => $link['project_id'])) ?>
+ <?= $this->a(t('Edit'), 'link', 'edit', array('link_id' => $link['id'])) ?>
<?= t('or') ?>
- <?= $this->a(t('Remove'), 'link', 'confirm', array('link_id' => $link['link_id'], 'project_id' => $link['project_id'])) ?>
+ <?= $this->a(t('Remove'), 'link', 'confirm', array('link_id' => $link['id'])) ?>
</ul>
</td>
</tr>
<?php endforeach ?>
</table>
<?php else: ?>
- <?= t('There is no link yet.') ?>
+ <?= t('There is no link.') ?>
<?php endif ?>
-</section>
-<?= $this->render('link/edit', array('values' => $values, 'errors' => $errors, 'project' => $project)) ?>
+<?= $this->render('link/create', array('values' => $values, 'errors' => $errors)) ?> \ No newline at end of file
diff --git a/app/Template/link/remove.php b/app/Template/link/remove.php
index d0b14b08..a802feb0 100644
--- a/app/Template/link/remove.php
+++ b/app/Template/link/remove.php
@@ -1,17 +1,15 @@
-<section id="main">
- <div class="page-header">
- <h2><?= t('Remove a link') ?></h2>
- </div>
+<div class="page-header">
+ <h2><?= t('Remove a link') ?></h2>
+</div>
- <div class="confirm">
- <p class="alert alert-info">
- <?= t('Do you really want to remove this link: "%s"?', t($link[0]['label']).(isset($link[1]['label']) ? ' | '.t($link[1]['label']) : '')) ?>
- </p>
+<div class="confirm">
+ <p class="alert alert-info">
+ <?= t('Do you really want to remove this link: "%s"?', $link['label']) ?>
+ </p>
- <div class="form-actions">
- <?= $this->a(t('Yes'), 'link', 'remove', array('project_id' => $project['id'], 'link_id' => $link[0]['link_id']), true, 'btn btn-red') ?>
- <?= t('or') ?>
- <?= $this->a(t('cancel'), 'link', 'index', array('project_id' => $project['id'])) ?>
- </div>
+ <div class="form-actions">
+ <?= $this->a(t('Yes'), 'link', 'remove', array('link_id' => $link['id']), true, 'btn btn-red') ?>
+ <?= t('or') ?>
+ <?= $this->a(t('cancel'), 'link', 'index') ?>
</div>
-</section> \ No newline at end of file
+</div> \ No newline at end of file
diff --git a/app/Template/task/public.php b/app/Template/task/public.php
index c66b2433..d7acef9f 100644
--- a/app/Template/task/public.php
+++ b/app/Template/task/public.php
@@ -10,19 +10,19 @@
'is_public' => true
)) ?>
- <?= $this->render('subtask/show', array(
+ <?= $this->render('tasklink/show', array(
'task' => $task,
- 'subtasks' => $subtasks,
+ 'links' => $links,
+ 'project' => $project,
'not_editable' => true
)) ?>
- <?= $this->render('tasklink/show', array(
+ <?= $this->render('subtask/show', array(
'task' => $task,
- 'links' => $links,
- 'project' => $project,
+ 'subtasks' => $subtasks,
'not_editable' => true
)) ?>
-
+
<?= $this->render('task/comments', array(
'task' => $task,
'comments' => $comments,
diff --git a/app/Template/task/show.php b/app/Template/task/show.php
index f968a409..1ff2ef43 100644
--- a/app/Template/task/show.php
+++ b/app/Template/task/show.php
@@ -1,8 +1,8 @@
<?= $this->render('task/details', array('task' => $task, 'project' => $project)) ?>
<?= $this->render('task/time', array('task' => $task, 'values' => $values, 'date_format' => $date_format, 'date_formats' => $date_formats)) ?>
<?= $this->render('task/show_description', array('task' => $task)) ?>
+<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links)) ?>
<?= $this->render('subtask/show', array('task' => $task, 'subtasks' => $subtasks)) ?>
<?= $this->render('task/timesheet', array('task' => $task)) ?>
-<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links, 'link_list' => $link_list, 'task_list' => $task_list)) ?>
<?= $this->render('file/show', array('task' => $task, 'files' => $files)) ?>
<?= $this->render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?>
diff --git a/app/Template/tasklink/create.php b/app/Template/tasklink/create.php
new file mode 100644
index 00000000..fb438cd8
--- /dev/null
+++ b/app/Template/tasklink/create.php
@@ -0,0 +1,27 @@
+<div class="page-header">
+ <h2><?= t('Add a new link') ?></h2>
+</div>
+
+<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off">
+
+ <?= $this->formCsrf() ?>
+ <?= $this->formHidden('task_id', $values) ?>
+ <?= $this->formHidden('opposite_task_id', $values) ?>
+
+ <?= $this->formLabel(t('Label'), 'link_id') ?>
+ <?= $this->formSelect('link_id', $labels, $values, $errors) ?>
+
+ <?= $this->formLabel(t('Task'), 'title') ?>
+ <?= $this->formText(
+ 'title',
+ $values,
+ $errors,
+ array('required', 'data-dst-field="opposite_task_id"', 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"'),
+ 'task-autocomplete') ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/tasklink/edit.php b/app/Template/tasklink/edit.php
deleted file mode 100644
index e1fcded2..00000000
--- a/app/Template/tasklink/edit.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<div class="page-header">
- <?php if (! isset($edit)): ?>
- <h2><?= t('Add a link') ?></h2>
- <?php else: ?>
- <h2><?= t('Edit a link') ?></h2>
- <?php endif ?>
-</div>
-
-<?php if (!empty($link_list)): ?>
-<form method="post" action="<?= $this->u('tasklink', isset($edit) ? 'update' : 'save', array('task_id' => $task['id'], 'link_id' => @$values['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
-
- <?= $this->formCsrf() ?>
-
- <?php if (isset($edit)): ?>
- <?= $this->formHidden('id', $values) ?>
- <?= $this->formHidden('task_link_inverse_id', $values) ?>
- <?php endif ?>
- <?= $this->formHidden('task_id', $values) ?>
-
- #<?= $task['id'] ?>
- &#160;
- <?= $this->formSelect('link_label_id', $link_list, $values, $errors, 'required autofocus') ?>
- &#160;
- #<?= $this->formNumeric('task_inverse_id', $values, $errors, 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 ?>
- <br/>
-
- <?php if (! isset($edit)): ?>
- <?= $this->formCheckbox('another_link', t('Create another link'), 1, isset($values['another_link']) && $values['another_link'] == 1) ?>
- <?php endif ?>
-
- <div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
- <?= t('or') ?>
- <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
- </div>
-</form>
-<?php else: ?>
-<div class="alert alert-info">
- <?= t('You need to add link labels to this project before to link this task to another one.') ?>
- <ul>
- <li><?= $this->a(t('Add link labels'), 'link', 'index', array('project_id' => $task['project_id'])) ?></li>
- </ul>
-</div>
-<?php endif ?>
diff --git a/app/Template/tasklink/remove.php b/app/Template/tasklink/remove.php
index 2ed87be7..9322ec24 100644
--- a/app/Template/tasklink/remove.php
+++ b/app/Template/tasklink/remove.php
@@ -4,13 +4,11 @@
<div class="confirm">
<p class="alert alert-info">
- <?= t('Do you really want to remove this link with task #%s?', $link['task_inverse_id']) ?>
- <br />
-
+ <?= t('Do you really want to remove this link with task #%d?', $link['opposite_task_id']) ?>
</p>
<div class="form-actions">
- <?= $this->a(t('Yes'), 'tasklink', 'remove', array('task_id' => $task['id'], 'link_id' => $link['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?>
+ <?= $this->a(t('Yes'), 'tasklink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?>
<?= t('or') ?>
<?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</div>
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