summaryrefslogtreecommitdiff
path: root/app/Template/subtask
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-26 19:30:02 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-26 19:30:02 -0500
commitf3deb6492a74f1ffa9e3391274e0ab7947a04016 (patch)
treecbf7a3563cf1543bd131dd114f8dc89afdf5328f /app/Template/subtask
parent4f325193be4f16a9658258fecd525e71917156a0 (diff)
Add toggle button to show/hide subtasks in task list view
Diffstat (limited to 'app/Template/subtask')
-rw-r--r--app/Template/subtask/table.php24
-rw-r--r--app/Template/subtask/timer.php13
2 files changed, 19 insertions, 18 deletions
diff --git a/app/Template/subtask/table.php b/app/Template/subtask/table.php
index bfb42e75..5488796d 100644
--- a/app/Template/subtask/table.php
+++ b/app/Template/subtask/table.php
@@ -21,9 +21,9 @@
'task' => $task,
'subtask' => $subtask,
)) ?>
- <?= $this->subtask->toggleStatus($subtask, $task['project_id'], true) ?>
+ <?= $this->subtask->renderToggleStatus($task, $subtask, true) ?>
<?php else: ?>
- <?= $this->subtask->getTitle($subtask) ?>
+ <?= $this->subtask->renderTitle($subtask) ?>
<?php endif ?>
</td>
<td>
@@ -33,22 +33,10 @@
</td>
<?= $this->hook->render('template:subtask:table:rows', array('subtask' => $subtask)) ?>
<td>
- <?php if (! empty($subtask['time_spent'])): ?>
- <strong><?= $this->text->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
- <?php endif ?>
-
- <?php if (! empty($subtask['time_estimated'])): ?>
- <strong><?= $this->text->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
- <?php endif ?>
-
- <?php if ($editable && $subtask['user_id'] == $this->user->getId()): ?>
- <?php if ($subtask['is_timer_started']): ?>
- <?= $this->url->icon('pause', t('Stop timer'), 'SubtaskStatusController', 'timer', array('timer' => 'stop', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']), false, 'subtask-toggle-timer') ?>
- (<?= $this->dt->age($subtask['timer_start_date']) ?>)
- <?php else: ?>
- <?= $this->url->icon('play-circle-o', t('Start timer'), 'SubtaskStatusController', 'timer', array('timer' => 'start', 'project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id']), false, 'subtask-toggle-timer') ?>
- <?php endif ?>
- <?php endif ?>
+ <?= $this->render('subtask/timer', array(
+ 'task' => $task,
+ 'subtask' => $subtask,
+ )) ?>
</td>
</tr>
<?php endforeach ?>
diff --git a/app/Template/subtask/timer.php b/app/Template/subtask/timer.php
new file mode 100644
index 00000000..2102e6cc
--- /dev/null
+++ b/app/Template/subtask/timer.php
@@ -0,0 +1,13 @@
+<span class="subtask-time-tracking">
+ <?php if (! empty($subtask['time_spent'])): ?>
+ <strong><?= $this->text->e($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($subtask['time_estimated'])): ?>
+ <strong><?= $this->text->e($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+
+ <?php if ($this->user->hasProjectAccess('SubtaskController', 'edit', $task['project_id']) && $subtask['user_id'] == $this->user->getId()): ?>
+ <?= $this->subtask->renderTimer($task, $subtask) ?>
+ <?php endif ?>
+</span>