summaryrefslogtreecommitdiff
path: root/app/Template/subtask
diff options
context:
space:
mode:
author85pando <85pando@googlemail.com>2016-02-05 10:28:40 +0100
committer85pando <85pando@googlemail.com>2016-02-05 10:28:40 +0100
commit791d13c87bf510d913973b77a5f6d152311a1d87 (patch)
tree81412e8dbd3ac4fa0047030a6068afafd975687e /app/Template/subtask
parent2074aaaa9a75455097e4e77ca09f4fba3e567052 (diff)
parent12aaec03b19a07635f59b00f532c92c37ac1df5f (diff)
Merge remote-tracking branch 'refs/remotes/upstream/master'
Conflicts: app/Locale/de_DE/translations.php
Diffstat (limited to 'app/Template/subtask')
-rw-r--r--app/Template/subtask/create.php19
-rw-r--r--app/Template/subtask/edit.php23
-rw-r--r--app/Template/subtask/icons.php7
-rw-r--r--app/Template/subtask/menu.php21
-rw-r--r--app/Template/subtask/remove.php2
-rw-r--r--app/Template/subtask/restriction_change_status.php19
-rw-r--r--app/Template/subtask/show.php98
-rw-r--r--app/Template/subtask/table.php69
8 files changed, 109 insertions, 149 deletions
diff --git a/app/Template/subtask/create.php b/app/Template/subtask/create.php
index 82e378f5..8fffd3a9 100644
--- a/app/Template/subtask/create.php
+++ b/app/Template/subtask/create.php
@@ -2,26 +2,19 @@
<h2><?= t('Add a sub-task') ?></h2>
</div>
-<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
+<form class="popover-form" method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
-
<?= $this->form->hidden('task_id', $values) ?>
-
- <?= $this->form->label(t('Title'), 'title') ?>
- <?= $this->form->text('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/>
-
- <?= $this->form->label(t('Assignee'), 'user_id') ?>
- <?= $this->form->select('user_id', $users_list, $values, $errors) ?><br/>
-
- <?= $this->form->label(t('Original estimate'), 'time_estimated') ?>
- <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
+ <?= $this->subtask->selectTitle($values, $errors, array('autofocus')) ?>
+ <?= $this->subtask->selectAssignee($users_list, $values, $errors) ?>
+ <?= $this->subtask->selectTimeEstimated($values, $errors) ?>
<?= $this->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"/>
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
<?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div>
</form>
diff --git a/app/Template/subtask/edit.php b/app/Template/subtask/edit.php
index 2e583069..acce625e 100644
--- a/app/Template/subtask/edit.php
+++ b/app/Template/subtask/edit.php
@@ -2,28 +2,19 @@
<h2><?= t('Edit a sub-task') ?></h2>
</div>
-<form method="post" action="<?= $this->url->href('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off">
+<form class="popover-form" method="post" action="<?= $this->url->href('subtask', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
-
<?= $this->form->hidden('id', $values) ?>
<?= $this->form->hidden('task_id', $values) ?>
-
- <?= $this->form->label(t('Title'), 'title') ?>
- <?= $this->form->text('title', $values, $errors, array('required', 'autofocus', 'maxlength="255"')) ?><br/>
-
- <?= $this->form->label(t('Assignee'), 'user_id') ?>
- <?= $this->form->select('user_id', $users_list, $values, $errors) ?><br/>
-
- <?= $this->form->label(t('Original estimate'), 'time_estimated') ?>
- <?= $this->form->numeric('time_estimated', $values, $errors) ?> <?= t('hours') ?><br/>
-
- <?= $this->form->label(t('Time spent'), 'time_spent') ?>
- <?= $this->form->numeric('time_spent', $values, $errors) ?> <?= t('hours') ?><br/>
+ <?= $this->subtask->selectTitle($values, $errors, array('autofocus')) ?>
+ <?= $this->subtask->selectAssignee($users_list, $values, $errors) ?>
+ <?= $this->subtask->selectTimeEstimated($values, $errors) ?>
+ <?= $this->subtask->selectTimeSpent($values, $errors) ?>
<div class="form-actions">
- <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
<?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div>
</form>
diff --git a/app/Template/subtask/icons.php b/app/Template/subtask/icons.php
deleted file mode 100644
index 1f31d51f..00000000
--- a/app/Template/subtask/icons.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php if ($subtask['status'] == 0): ?>
- <i class="fa fa-square-o fa-fw"></i>
-<?php elseif ($subtask['status'] == 1): ?>
- <i class="fa fa-gears fa-fw"></i>
-<?php else: ?>
- <i class="fa fa-check-square-o fa-fw"></i>
-<?php endif ?> \ No newline at end of file
diff --git a/app/Template/subtask/menu.php b/app/Template/subtask/menu.php
new file mode 100644
index 00000000..878ad68c
--- /dev/null
+++ b/app/Template/subtask/menu.php
@@ -0,0 +1,21 @@
+<div class="dropdown">
+ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
+ <ul>
+ <?php if ($subtask['position'] != $first_position): ?>
+ <li>
+ <?= $this->url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $task['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($subtask['position'] != $last_position): ?>
+ <li>
+ <?= $this->url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $task['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?>
+ </li>
+ <?php endif ?>
+ <li>
+ <?= $this->url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?>
+ </li>
+ <li>
+ <?= $this->url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), false, 'popover') ?>
+ </li>
+ </ul>
+</div>
diff --git a/app/Template/subtask/remove.php b/app/Template/subtask/remove.php
index 65ade31d..9aef6842 100644
--- a/app/Template/subtask/remove.php
+++ b/app/Template/subtask/remove.php
@@ -12,6 +12,6 @@
<div class="form-actions">
<?= $this->url->link(t('Yes'), 'subtask', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id']), true, 'btn btn-red') ?>
<?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div>
</div> \ No newline at end of file
diff --git a/app/Template/subtask/restriction_change_status.php b/app/Template/subtask/restriction_change_status.php
deleted file mode 100644
index 88e91d82..00000000
--- a/app/Template/subtask/restriction_change_status.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<div class="page-header">
- <h2><?= t('You already have one subtask in progress') ?></h2>
-</div>
-
- <form action="<?= $this->url->href('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post">
-
- <?= $this->form->csrf() ?>
- <?= $this->form->hidden('redirect', array('redirect' => $redirect)) ?>
-
- <p><?= t('Select the new status of the subtask: "%s"', $subtask_inprogress['title']) ?></p>
- <?= $this->form->radios('status', $status_list) ?>
- <?= $this->form->hidden('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 6945840f..b0326c48 100644
--- a/app/Template/subtask/show.php
+++ b/app/Template/subtask/show.php
@@ -1,100 +1,12 @@
-<div id="subtasks" class="task-show-section">
-
- <?php if (! empty($subtasks)): ?>
- <div class="page-header">
- <h2><?= t('Sub-Tasks') ?></h2>
- </div>
+<div class="page-header">
+ <h2><?= t('Sub-Tasks') ?></h2>
+</div>
- <?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, 'task') ?>
- <?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 ?>
+<div id="subtasks">
- <?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>
- <div class="dropdown">
- <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
- <ul>
- <?php if ($subtask['position'] != $first_position): ?>
- <li>
- <?= $this->url->link(t('Move Up'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up'), true) ?>
- </li>
- <?php endif ?>
- <?php if ($subtask['position'] != $last_position): ?>
- <li>
- <?= $this->url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?>
- </li>
- <?php endif ?>
- <li>
- <?= $this->url->link(t('Edit'), 'subtask', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
- </li>
- <li>
- <?= $this->url->link(t('Remove'), 'subtask', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>
- </li>
- </ul>
- </div>
- </td>
- <?php endif ?>
- </tr>
- <?php endforeach ?>
- </table>
- <?php endif ?>
+ <?= $this->render('subtask/table', array('subtasks' => $subtasks, 'task' => $task, 'editable' => $editable)) ?>
<?php if ($editable && $this->user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?>
- <?php if (empty($subtasks)): ?>
- <div class="page-header">
- <h2><?= t('Sub-Tasks') ?></h2>
- </div>
- <?php endif ?>
<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
diff --git a/app/Template/subtask/table.php b/app/Template/subtask/table.php
new file mode 100644
index 00000000..13f7ada6
--- /dev/null
+++ b/app/Template/subtask/table.php
@@ -0,0 +1,69 @@
+<?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, $task['project_id']) ?>
+ <?php else: ?>
+ <?= $this->subtask->getTitle($subtask) ?>
+ <?php endif ?>
+ </td>
+ <td>
+ <?php if (! empty($subtask['username'])): ?>
+ <?= $this->e($subtask['name'] ?: $subtask['username']) ?>
+ <?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(
+ 'task' => $task,
+ 'subtask' => $subtask,
+ '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 ?>