summaryrefslogtreecommitdiff
path: root/app/Template/subtask/show.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-04 21:38:53 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-04 21:38:53 -0500
commit0f2b46dd6a9a1dc17768de2c415f382df95142e8 (patch)
tree55191fce45c7c06b7d2b45834ea4151745c3db77 /app/Template/subtask/show.php
parent346151e103431e8de12520b26daae10676b8faf5 (diff)
Do not refresh the whole page when changing subtask status (work in progress)
Diffstat (limited to 'app/Template/subtask/show.php')
-rw-r--r--app/Template/subtask/show.php77
1 files changed, 2 insertions, 75 deletions
diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php
index cf56a1de..b0326c48 100644
--- a/app/Template/subtask/show.php
+++ b/app/Template/subtask/show.php
@@ -2,82 +2,9 @@
<h2><?= t('Sub-Tasks') ?></h2>
</div>
-<div id="subtasks" class="task-show-section">
+<div id="subtasks">
- <?php if (! empty($subtasks)): ?>
-
- <?php $first_position = $subtasks[0]['position']; ?>
- <?php $last_position = $subtasks[count($subtasks) - 1]['position']; ?>
- <table class="subtasks-table">
- <tr>
- <th class="column-40"><?= t('Title') ?></th>
- <th><?= t('Assignee') ?></th>
- <th><?= t('Time tracking') ?></th>
- <?php if ($editable): ?>
- <th class="column-5"></th>
- <?php endif ?>
- </tr>
- <?php foreach ($subtasks as $subtask): ?>
- <tr>
- <td>
- <?php if ($editable): ?>
- <?= $this->subtask->toggleStatus($subtask, $redirect) ?>
- <?php else: ?>
- <?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['title']) ?>
- <?php endif ?>
- </td>
- <td>
- <?php if (! empty($subtask['username'])): ?>
- <?php if ($editable): ?>
- <?= $this->url->link($this->e($subtask['name'] ?: $subtask['username']), 'user', 'show', array('user_id' => $subtask['user_id'])) ?>
- <?php else: ?>
- <?= $this->e($subtask['name'] ?: $subtask['username']) ?>
- <?php endif ?>
- <?php endif ?>
- </td>
- <td>
- <ul class="no-bullet">
- <li>
- <?php if (! empty($subtask['time_spent'])): ?>
- <strong><?= $this->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
- <?php endif ?>
-
- <?php if (! empty($subtask['time_estimated'])): ?>
- <strong><?= $this->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
- <?php endif ?>
- </li>
- <?php if ($editable && $subtask['user_id'] == $this->user->getId()): ?>
- <li>
- <?php if ($subtask['is_timer_started']): ?>
- <i class="fa fa-pause"></i>
- <?= $this->url->link(t('Stop timer'), 'timer', 'subtask', array('timer' => 'stop', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'])) ?>
- (<?= $this->dt->age($subtask['timer_start_date']) ?>)
- <?php else: ?>
- <i class="fa fa-play-circle-o"></i>
- <?= $this->url->link(t('Start timer'), 'timer', 'subtask', array('timer' => 'start', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'])) ?>
- <?php endif ?>
- </li>
- <?php endif ?>
- </ul>
- </td>
- <?php if ($editable): ?>
- <td>
- <?= $this->render('subtask/menu', array(
- 'project' => $project,
- 'task' => $task,
- 'subtask' => $subtask,
- 'redirect' => $redirect,
- 'first_position' => $first_position,
- 'last_position' => $last_position,
- )) ?>
- </td>
- <?php endif ?>
- </tr>
- <?php endforeach ?>
- </table>
- <?php else: ?>
- <p class="alert"><?= t('There is no subtask at the moment.') ?></p>
- <?php endif ?>
+ <?= $this->render('subtask/table', array('subtasks' => $subtasks, 'task' => $task, 'editable' => $editable)) ?>
<?php if ($editable && $this->user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?>
<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">