summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-02-04 22:19:32 -0500
committerFrederic Guillot <fred@kanboard.net>2015-02-04 22:19:32 -0500
commitb24b1e7e4e5ee0551ee56aa0f21c4425b479db2e (patch)
tree5fffaeb461707dada9f2909101d51c9da3c77a50 /app/Template
parent2d070627d751bf5728ec98a5efaf163532594cd9 (diff)
Add subtasks restrictions and time tracking
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/app/subtasks.php2
-rw-r--r--app/Template/board/subtasks.php9
-rw-r--r--app/Template/config/board.php3
-rw-r--r--app/Template/subtask/edit.php3
-rw-r--r--app/Template/subtask/restriction_change_status.php19
-rw-r--r--app/Template/subtask/show.php5
-rw-r--r--app/Template/user/sidebar.php3
-rw-r--r--app/Template/user/timesheet.php27
8 files changed, 56 insertions, 15 deletions
diff --git a/app/Template/app/subtasks.php b/app/Template/app/subtasks.php
index 75320027..0948e8f5 100644
--- a/app/Template/app/subtasks.php
+++ b/app/Template/app/subtasks.php
@@ -18,7 +18,7 @@
<?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
</td>
<td>
- <?= $this->e($subtask['status_name']) ?>
+ <?= $this->toggleSubtaskStatus($subtask, 'dashboard') ?>
</td>
<td>
<?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
diff --git a/app/Template/board/subtasks.php b/app/Template/board/subtasks.php
index 1cb05498..18f7f9da 100644
--- a/app/Template/board/subtasks.php
+++ b/app/Template/board/subtasks.php
@@ -1,14 +1,7 @@
<section id="tooltip-subtasks">
<?php foreach ($subtasks as $subtask): ?>
- <?= $this->a(
- trim($this->render('subtask/icons', array('subtask' => $subtask))) . $this->e($subtask['title']),
- 'board',
- 'toggleSubtask',
- array('task_id' => $subtask['task_id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])
- ) ?>
-
+ <?= $this->toggleSubtaskStatus($subtask, 'board') ?>
<?= $this->e(empty($subtask['username']) ? '' : ' ['.$this->getFullname($subtask).']') ?>
-
<br/>
<?php endforeach ?>
</section>
diff --git a/app/Template/config/board.php b/app/Template/config/board.php
index d7f8ee44..57efcd08 100644
--- a/app/Template/config/board.php
+++ b/app/Template/config/board.php
@@ -26,6 +26,9 @@
<?= $this->formText('project_categories', $values, $errors) ?><br/>
<p class="form-help"><?= t('Example: "Bug, Feature Request, Improvement"') ?></p>
+ <?= $this->formCheckbox('subtask_restriction', t('Allow only one subtask in progress at the same time for a user'), 1, $values['subtask_restriction'] == 1) ?>
+ <?= $this->formCheckbox('subtask_time_tracking', t('Enable time tracking for subtasks'), 1, $values['subtask_time_tracking'] == 1) ?>
+
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
</div>
diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php
index 8350dc09..f34d9532 100644
--- a/app/Template/subtask/edit.php
+++ b/app/Template/subtask/edit.php
@@ -12,9 +12,6 @@
<?= $this->formLabel(t('Title'), 'title') ?>
<?= $this->formText('title', $values, $errors, array('required', 'autofocus', 'maxlength="50"')) ?><br/>
- <?= $this->formLabel(t('Status'), 'status') ?>
- <?= $this->formSelect('status', $status_list, $values, $errors) ?><br/>
-
<?= $this->formLabel(t('Assignee'), 'user_id') ?>
<?= $this->formSelect('user_id', $users_list, $values, $errors) ?><br/>
diff --git a/app/Template/subtask/restriction_change_status.php b/app/Template/subtask/restriction_change_status.php
new file mode 100644
index 00000000..99e022f8
--- /dev/null
+++ b/app/Template/subtask/restriction_change_status.php
@@ -0,0 +1,19 @@
+<div class="page-header">
+ <h2><?= t('You already have one subtask in progress') ?></h2>
+</div>
+
+ <form action="<?= $this->u('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post">
+
+ <?= $this->formCsrf() ?>
+ <?= $this->formHidden('redirect', array('redirect' => $redirect)) ?>
+
+ <p><?= t('Select the new status of the subtask: "%s"', $subtask_inprogress['title']) ?></p>
+ <?= $this->formRadios('status', $status_list) ?>
+ <?= $this->formHidden('id', $subtask_inprogress) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-red"/>
+ <?= t('or') ?>
+ <a href="#" class="close-popover"><?= t('cancel') ?></a>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php
index 265883b7..6d4533d2 100644
--- a/app/Template/subtask/show.php
+++ b/app/Template/subtask/show.php
@@ -20,15 +20,14 @@
<td><?= $this->e($subtask['title']) ?></td>
<td>
<?php if (! isset($not_editable)): ?>
- <?= $this->a(trim($this->render('subtask/icons', array('subtask' => $subtask))) . $this->e($subtask['status_name']),
- 'subtask', 'toggleStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
+ <?= $this->toggleSubtaskStatus($subtask, 'task') ?>
<?php else: ?>
<?= $this->render('subtask/icons', array('subtask' => $subtask)) . $this->e($subtask['status_name']) ?>
<?php endif ?>
</td>
<td>
<?php if (! empty($subtask['username'])): ?>
- <?= $this->e($subtask['name'] ?: $subtask['username']) ?>
+ <?= $this->a($this->e($subtask['name'] ?: $subtask['username']), 'user', 'show', array('user_id' => $subtask['user_id'])) ?>
<?php endif ?>
</td>
<td>
diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php
index 4376aa18..05be2e84 100644
--- a/app/Template/user/sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -28,6 +28,9 @@
<li>
<?= $this->a(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?>
</li>
+ <li>
+ <?= $this->a(t('Time tracking'), 'user', 'timesheet', array('user_id' => $user['id'])) ?>
+ </li>
<?php endif ?>
<?php if ($this->userSession->isAdmin()): ?>
diff --git a/app/Template/user/timesheet.php b/app/Template/user/timesheet.php
new file mode 100644
index 00000000..fb7e51f0
--- /dev/null
+++ b/app/Template/user/timesheet.php
@@ -0,0 +1,27 @@
+<div class="page-header">
+ <h2><?= t('Time Tracking') ?></h2>
+</div>
+
+<h3><?= t('Subtask timesheet') ?></h3>
+<?php if ($subtask_paginator->isEmpty()): ?>
+ <p class="alert"><?= t('There is nothing to show.') ?></p>
+<?php else: ?>
+ <table class="table-fixed">
+ <tr>
+ <th class="column-20"><?= $subtask_paginator->order('Task', 'task_title') ?></th>
+ <th class="column-20"><?= $subtask_paginator->order('Subtask', 'subtask_title') ?></th>
+ <th><?= $subtask_paginator->order(t('Start'), 'start') ?></th>
+ <th><?= $subtask_paginator->order(t('End'), 'end') ?></th>
+ </tr>
+ <?php foreach ($subtask_paginator->getCollection() as $record): ?>
+ <tr>
+ <td><?= $this->a($this->e($record['task_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td>
+ <td><?= $this->a($this->e($record['subtask_title']), 'task', 'show', array('project_id' => $record['project_id'], 'task_id' => $record['task_id'])) ?></td>
+ <td><?= dt('%B %e, %Y at %k:%M %p', $record['start']) ?></td>
+ <td><?= dt('%B %e, %Y at %k:%M %p', $record['end']) ?></td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+ <?= $subtask_paginator ?>
+<?php endif ?> \ No newline at end of file