summaryrefslogtreecommitdiff
path: root/app/Templates
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-25 15:02:27 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-25 15:02:27 -0400
commitf9753e91d288c4d87d6a83ffe994d312eae5a3fd (patch)
tree96877bed70873e55aa5139f0ac6245c817e5911d /app/Templates
parent9ddeb5d978db9b1f223c98bbe83ac40fc4474225 (diff)
Add subtasks
Diffstat (limited to 'app/Templates')
-rw-r--r--app/Templates/comment_remove.php2
-rw-r--r--app/Templates/file_show.php17
-rw-r--r--app/Templates/subtask_create.php25
-rw-r--r--app/Templates/subtask_edit.php30
-rw-r--r--app/Templates/subtask_remove.php16
-rw-r--r--app/Templates/subtask_show.php60
-rw-r--r--app/Templates/task_show.php23
-rw-r--r--app/Templates/task_sidebar.php1
8 files changed, 157 insertions, 17 deletions
diff --git a/app/Templates/comment_remove.php b/app/Templates/comment_remove.php
index 02a23f93..6409d7c0 100644
--- a/app/Templates/comment_remove.php
+++ b/app/Templates/comment_remove.php
@@ -1,5 +1,5 @@
<div class="page-header">
- <h2><?= t('Add a comment') ?></h2>
+ <h2><?= t('Remove a comment') ?></h2>
</div>
<div class="confirm">
diff --git a/app/Templates/file_show.php b/app/Templates/file_show.php
new file mode 100644
index 00000000..674861dd
--- /dev/null
+++ b/app/Templates/file_show.php
@@ -0,0 +1,17 @@
+<div class="page-header">
+ <h2><?= t('Attachments') ?></h2>
+</div>
+
+<ul class="task-show-files">
+<?php foreach ($files as $file): ?>
+ <li>
+ <a href="?controller=file&amp;action=download&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= Helper\escape($file['name']) ?></a>
+ <span class="task-show-file-actions">
+ <?php if ($file['is_image']): ?>
+ <a href="?controller=file&amp;action=open&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>" class="popover"><?= t('open') ?></a>,
+ <?php endif ?>
+ <a href="?controller=file&amp;action=confirm&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('remove') ?></a>
+ </span>
+ </li>
+<?php endforeach ?>
+</ul> \ No newline at end of file
diff --git a/app/Templates/subtask_create.php b/app/Templates/subtask_create.php
new file mode 100644
index 00000000..a456aa37
--- /dev/null
+++ b/app/Templates/subtask_create.php
@@ -0,0 +1,25 @@
+<div class="page-header">
+ <h2><?= t('Add a sub-task') ?></h2>
+</div>
+
+<form method="post" action="?controller=subtask&amp;action=save&amp;task_id=<?= $task['id'] ?>" autocomplete="off">
+
+ <?= Helper\form_hidden('task_id', $values) ?>
+
+ <?= Helper\form_label(t('Title'), 'title') ?>
+ <?= Helper\form_text('title', $values, $errors, array('required autofocus')) ?><br/>
+
+ <?= Helper\form_label(t('Assignee'), 'user_id') ?>
+ <?= Helper\form_select('user_id', $users_list, $values, $errors) ?><br/>
+
+ <?= Helper\form_label(t('Original Estimate'), 'time_estimated') ?>
+ <?= Helper\form_numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
+
+ <?= Helper\form_checkbox('another_subtask', t('Create another sub-task'), 1, isset($values['another_subtask']) && $values['another_subtask'] == 1) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
+ </div>
+</form>
diff --git a/app/Templates/subtask_edit.php b/app/Templates/subtask_edit.php
new file mode 100644
index 00000000..3080cdad
--- /dev/null
+++ b/app/Templates/subtask_edit.php
@@ -0,0 +1,30 @@
+<div class="page-header">
+ <h2><?= t('Edit a sub-task') ?></h2>
+</div>
+
+<form method="post" action="?controller=subtask&amp;action=update&amp;task_id=<?= $task['id'] ?>&amp;subtask_id=<?= $subtask['id'] ?>" autocomplete="off">
+
+ <?= Helper\form_hidden('id', $values) ?>
+ <?= Helper\form_hidden('task_id', $values) ?>
+
+ <?= Helper\form_label(t('Title'), 'title') ?>
+ <?= Helper\form_text('title', $values, $errors, array('required autofocus')) ?><br/>
+
+ <?= Helper\form_label(t('Status'), 'status') ?>
+ <?= Helper\form_select('status', $status_list, $values, $errors) ?><br/>
+
+ <?= Helper\form_label(t('Assignee'), 'user_id') ?>
+ <?= Helper\form_select('user_id', $users_list, $values, $errors) ?><br/>
+
+ <?= Helper\form_label(t('Original Estimate'), 'time_estimated') ?>
+ <?= Helper\form_numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
+
+ <?= Helper\form_label(t('Time Spent'), 'time_spent') ?>
+ <?= Helper\form_numeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
+ </div>
+</form>
diff --git a/app/Templates/subtask_remove.php b/app/Templates/subtask_remove.php
new file mode 100644
index 00000000..2862176c
--- /dev/null
+++ b/app/Templates/subtask_remove.php
@@ -0,0 +1,16 @@
+<div class="page-header">
+ <h2><?= t('Remove a sub-task') ?></h2>
+</div>
+
+<div class="confirm">
+ <p class="alert alert-info">
+ <?= t('Do you really want to remove this sub-task?') ?>
+ </p>
+
+ <p><strong><?= Helper\escape($subtask['title']) ?></strong></p>
+
+ <div class="form-actions">
+ <a href="?controller=subtask&amp;action=remove&amp;task_id=<?= $task['id'] ?>&amp;subtask_id=<?= $subtask['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a>
+ <?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>#subtasks"><?= t('cancel') ?></a>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/Templates/subtask_show.php b/app/Templates/subtask_show.php
new file mode 100644
index 00000000..b9385c7e
--- /dev/null
+++ b/app/Templates/subtask_show.php
@@ -0,0 +1,60 @@
+<div class="page-header">
+ <h2><?= t('Sub-Tasks') ?></h2>
+</div>
+
+<?php
+
+$total_spent = 0;
+$total_estimated = 0;
+$total_remaining = 0;
+
+?>
+
+<table class="subtasks-table">
+ <tr>
+ <th width="40%"><?= t('Title') ?></th>
+ <th><?= t('Status') ?></th>
+ <th><?= t('Assignee') ?></th>
+ <th><?= t('Time tracking') ?></th>
+ <th><?= t('Actions') ?></th>
+ </tr>
+ <?php foreach ($subtasks as $subtask): ?>
+ <tr>
+ <td><?= Helper\escape($subtask['title']) ?></td>
+ <td><?= Helper\escape($subtask['status_name']) ?></td>
+ <td>
+ <?php if (! empty($subtask['username'])): ?>
+ <?= Helper\escape($subtask['username']) ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <?php if (! empty($subtask['time_spent'])): ?>
+ <strong><?= Helper\escape($subtask['time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($subtask['time_estimated'])): ?>
+ <strong><?= Helper\escape($subtask['time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <a href="?controller=subtask&amp;action=edit&amp;task_id=<?= $task['id'] ?>&amp;subtask_id=<?= $subtask['id'] ?>"><?= t('Edit') ?></a>
+ <?= t('or') ?>
+ <a href="?controller=subtask&amp;action=confirm&amp;task_id=<?= $task['id'] ?>&amp;subtask_id=<?= $subtask['id'] ?>"><?= t('Remove') ?></a>
+ </td>
+ </tr>
+ <?php
+ $total_estimated += $subtask['time_estimated'];
+ $total_spent += $subtask['time_spent'];
+ $total_remaining = $total_estimated - $total_spent;
+ ?>
+ <?php endforeach ?>
+</table>
+
+<div class="subtasks-time-tracking">
+ <h4><?= t('Time tracking') ?></h4>
+ <ul>
+ <li><?= t('Estimate:') ?> <strong><?= Helper\escape($total_estimated) ?></strong> <?= t('hours') ?></li>
+ <li><?= t('Spent:') ?> <strong><?= Helper\escape($total_spent) ?></strong> <?= t('hours') ?></li>
+ <li><?= t('Remaining:') ?> <strong><?= Helper\escape($total_remaining > 0 ? $total_remaining : 0) ?></strong> <?= t('hours') ?></li>
+ </ul>
+</div> \ No newline at end of file
diff --git a/app/Templates/task_show.php b/app/Templates/task_show.php
index 53cdbae8..4c3d4697 100644
--- a/app/Templates/task_show.php
+++ b/app/Templates/task_show.php
@@ -62,23 +62,14 @@
<?php if (! empty($files)): ?>
<div id="attachments" class="task-show-section">
- <div class="page-header">
- <h2><?= t('Attachments') ?></h2>
- </div>
+ <?= Helper\template('file_show', array('task' => $task, 'files' => $files)) ?>
+</div>
+<?php endif ?>
- <ul class="task-show-files">
- <?php foreach ($files as $file): ?>
- <li>
- <a href="?controller=file&amp;action=download&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= Helper\escape($file['name']) ?></a>
- <span class="task-show-file-actions">
- <?php if ($file['is_image']): ?>
- <a href="?controller=file&amp;action=open&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>" class="popover"><?= t('open') ?></a>,
- <?php endif ?>
- <a href="?controller=file&amp;action=confirm&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('remove') ?></a>
- </span>
- </li>
- <?php endforeach ?>
- </ul>
+
+<?php if (! empty($subtasks)): ?>
+<div id="subtasks" class="task-show-section">
+ <?= Helper\template('subtask_show', array('task' => $task, 'subtasks' => $subtasks)) ?>
</div>
<?php endif ?>
diff --git a/app/Templates/task_sidebar.php b/app/Templates/task_sidebar.php
index 8a3939b8..d97c44e2 100644
--- a/app/Templates/task_sidebar.php
+++ b/app/Templates/task_sidebar.php
@@ -5,6 +5,7 @@
<li><a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('Summary') ?></a></li>
<li><a href="?controller=task&amp;action=edit&amp;task_id=<?= $task['id'] ?>"><?= t('Edit the task') ?></a></li>
<li><a href="?controller=task&amp;action=editDescription&amp;task_id=<?= $task['id'] ?>"><?= t('Edit the description') ?></a></li>
+ <li><a href="?controller=subtask&amp;action=create&amp;task_id=<?= $task['id'] ?>"><?= t('Add a sub-task') ?></a></li>
<li><a href="?controller=comment&amp;action=create&amp;task_id=<?= $task['id'] ?>"><?= t('Add a comment') ?></a></li>
<li><a href="?controller=file&amp;action=create&amp;task_id=<?= $task['id'] ?>"><?= t('Attach a document') ?></a></li>
<li><a href="?controller=task&amp;action=duplicate&amp;project_id=<?= $task['project_id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('Duplicate') ?></a></li>