summaryrefslogtreecommitdiff
path: root/app/Template
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
parent4f325193be4f16a9658258fecd525e71917156a0 (diff)
Add toggle button to show/hide subtasks in task list view
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/board/tooltip_subtasks.php2
-rw-r--r--app/Template/dashboard/subtasks.php2
-rw-r--r--app/Template/subtask/table.php24
-rw-r--r--app/Template/subtask/timer.php13
-rw-r--r--app/Template/task_list/header.php6
-rw-r--r--app/Template/task_list/listing.php13
-rw-r--r--app/Template/task_list/task_subtasks.php22
7 files changed, 59 insertions, 23 deletions
diff --git a/app/Template/board/tooltip_subtasks.php b/app/Template/board/tooltip_subtasks.php
index 335c28ce..753e4910 100644
--- a/app/Template/board/tooltip_subtasks.php
+++ b/app/Template/board/tooltip_subtasks.php
@@ -8,7 +8,7 @@
<?php foreach ($subtasks as $subtask): ?>
<tr>
<td>
- <?= $this->subtask->toggleStatus($subtask, $task['project_id']) ?>
+ <?= $this->subtask->renderToggleStatus($task, $subtask) ?>
</td>
<?= $this->hook->render('template:board:tooltip:subtasks:rows', array('subtask' => $subtask)) ?>
<td>
diff --git a/app/Template/dashboard/subtasks.php b/app/Template/dashboard/subtasks.php
index 13770f0f..d86b1ef9 100644
--- a/app/Template/dashboard/subtasks.php
+++ b/app/Template/dashboard/subtasks.php
@@ -25,7 +25,7 @@
<?= $this->url->link($this->text->e($subtask['task_name']), 'TaskViewController', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
</td>
<td>
- <?= $this->subtask->toggleStatus($subtask, $subtask['project_id']) ?>
+ <?= $this->subtask->renderToggleStatus(array('project_id' => $subtask['project_id']), $subtask) ?>
</td>
<?= $this->hook->render('template:dashboard:subtasks:rows', array('subtask' => $subtask)) ?>
<td>
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>
diff --git a/app/Template/task_list/header.php b/app/Template/task_list/header.php
index fb05dbdc..6501a919 100644
--- a/app/Template/task_list/header.php
+++ b/app/Template/task_list/header.php
@@ -7,6 +7,12 @@
<?php endif ?>
</div>
<div class="table-list-header-menu">
+ <?php if ($this->user->hasSubtaskListActivated()): ?>
+ <?= $this->url->icon('tasks', t('Hide subtasks'), 'TaskListController', 'show', array('project_id' => $project['id'], 'hide_subtasks' => 1)) ?>
+ <?php else: ?>
+ <?= $this->url->icon('tasks', t('Show subtasks'), 'TaskListController', 'show', array('project_id' => $project['id'], 'show_subtasks' => 1)) ?>
+ <?php endif ?>
+
<?= $this->render('task_list/sort_menu', array('paginator' => $paginator)) ?>
</div>
</div> \ No newline at end of file
diff --git a/app/Template/task_list/listing.php b/app/Template/task_list/listing.php
index 171c148d..b3c66aa6 100644
--- a/app/Template/task_list/listing.php
+++ b/app/Template/task_list/listing.php
@@ -5,7 +5,11 @@
<p class="alert"><?= t('No tasks found.') ?></p>
<?php elseif (! $paginator->isEmpty()): ?>
<div class="table-list">
- <?= $this->render('task_list/header', array('paginator' => $paginator)) ?>
+ <?= $this->render('task_list/header', array(
+ 'paginator' => $paginator,
+ 'project' => $project,
+ )) ?>
+
<?php foreach ($paginator->getCollection() as $task): ?>
<div class="table-list-row color-<?= $task['color_id'] ?>">
<?= $this->render('task_list/task_title', array(
@@ -21,8 +25,11 @@
)) ?>
<?= $this->render('task_list/task_icons', array(
- 'project' => $project,
- 'task' => $task,
+ 'task' => $task,
+ )) ?>
+
+ <?= $this->render('task_list/task_subtasks', array(
+ 'task' => $task,
)) ?>
</div>
<?php endforeach ?>
diff --git a/app/Template/task_list/task_subtasks.php b/app/Template/task_list/task_subtasks.php
new file mode 100644
index 00000000..716d6df2
--- /dev/null
+++ b/app/Template/task_list/task_subtasks.php
@@ -0,0 +1,22 @@
+<?php if (! empty($task['subtasks'])): ?>
+<div class="task-list-subtasks">
+ <?php foreach ($task['subtasks'] as $subtask): ?>
+ <div class="task-list-subtask">
+ <span class="subtask-cell column-50">
+ <?= $this->subtask->renderToggleStatus($task, $subtask) ?>
+ </span>
+ <span class="subtask-cell column-20 subtask-assignee">
+ <?php if (! empty($subtask['username'])): ?>
+ <?= $this->text->e($subtask['name'] ?: $subtask['username']) ?>
+ <?php endif ?>
+ </span>
+ <span class="subtask-cell subtask-time-tracking-cell">
+ <?= $this->render('subtask/timer', array(
+ 'task' => $task,
+ 'subtask' => $subtask,
+ )) ?>
+ </span>
+ </div>
+ <?php endforeach ?>
+</div>
+<?php endif ?>