summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-04 21:38:53 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-04 21:38:53 -0500
commit0f2b46dd6a9a1dc17768de2c415f382df95142e8 (patch)
tree55191fce45c7c06b7d2b45834ea4151745c3db77 /app/Template
parent346151e103431e8de12520b26daae10676b8faf5 (diff)
Do not refresh the whole page when changing subtask status (work in progress)
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/app/subtasks.php2
-rw-r--r--app/Template/board/tooltip_subtasks.php15
-rw-r--r--app/Template/subtask/icons.php7
-rw-r--r--app/Template/subtask/menu.php4
-rw-r--r--app/Template/subtask/show.php77
-rw-r--r--app/Template/subtask/table.php69
-rw-r--r--app/Template/subtask_restriction/popover.php (renamed from app/Template/subtask/restriction_change_status.php)6
-rw-r--r--app/Template/task/show.php5
8 files changed, 88 insertions, 97 deletions
diff --git a/app/Template/app/subtasks.php b/app/Template/app/subtasks.php
index b4c87bab..f72f21fb 100644
--- a/app/Template/app/subtasks.php
+++ b/app/Template/app/subtasks.php
@@ -24,7 +24,7 @@
<?= $this->url->link($this->e($subtask['task_name']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
</td>
<td>
- <?= $this->subtask->toggleStatus($subtask, 'dashboard') ?>
+ <?= $this->subtask->toggleStatus($subtask, $subtask['project_id']) ?>
</td>
<td>
<?php if (! empty($subtask['time_spent'])): ?>
diff --git a/app/Template/board/tooltip_subtasks.php b/app/Template/board/tooltip_subtasks.php
index 5e48fcf4..65b7ce4d 100644
--- a/app/Template/board/tooltip_subtasks.php
+++ b/app/Template/board/tooltip_subtasks.php
@@ -1,7 +1,12 @@
-<section id="tooltip-subtasks">
+<table class="table-stripped">
<?php foreach ($subtasks as $subtask): ?>
- <?= $this->subtask->toggleStatus($subtask, 'board', $task['project_id']) ?>
- <?= $this->e(empty($subtask['username']) ? '' : ' ['.$this->user->getFullname($subtask).']') ?>
- <br>
+ <tr>
+ <td class="column-80">
+ <?= $this->subtask->toggleStatus($subtask, $task['project_id']) ?>
+ </td>
+ <td>
+ <?= $this->e($subtask['username'] ?: $this->user->getFullname($subtask)) ?>
+ </td>
+ </tr>
<?php endforeach ?>
-</section>
+</table>
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
index f14b09b2..878ad68c 100644
--- a/app/Template/subtask/menu.php
+++ b/app/Template/subtask/menu.php
@@ -3,12 +3,12 @@
<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', 'redirect' => $redirect), true) ?>
+ <?= $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' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down', 'redirect' => $redirect), true) ?>
+ <?= $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>
diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php
index cf56a1de..b0326c48 100644
--- a/app/Template/subtask/show.php
+++ b/app/Template/subtask/show.php
@@ -2,82 +2,9 @@
<h2><?= t('Sub-Tasks') ?></h2>
</div>
-<div id="subtasks" class="task-show-section">
+<div id="subtasks">
- <?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, $redirect) ?>
- <?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 ?>
-
- <?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(
- 'project' => $project,
- 'task' => $task,
- 'subtask' => $subtask,
- 'redirect' => $redirect,
- '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 ?>
+ <?= $this->render('subtask/table', array('subtasks' => $subtasks, 'task' => $task, 'editable' => $editable)) ?>
<?php if ($editable && $this->user->hasProjectAccess('subtask', 'save', $task['project_id'])): ?>
<form method="post" action="<?= $this->url->href('subtask', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" autocomplete="off">
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 ?>
diff --git a/app/Template/subtask/restriction_change_status.php b/app/Template/subtask_restriction/popover.php
index 88e91d82..e80d6b6d 100644
--- a/app/Template/subtask/restriction_change_status.php
+++ b/app/Template/subtask_restriction/popover.php
@@ -1,18 +1,16 @@
<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">
+<form class="popover-form" action="<?= $this->url->href('SubtaskRestriction', 'update', 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"/>
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-red">
<?= t('or') ?>
<a href="#" class="close-popover"><?= t('cancel') ?></a>
</div>
diff --git a/app/Template/task/show.php b/app/Template/task/show.php
index 246c8f33..e18b47fc 100644
--- a/app/Template/task/show.php
+++ b/app/Template/task/show.php
@@ -18,15 +18,14 @@
'subtasks' => $subtasks,
'project' => $project,
'users_list' => isset($users_list) ? $users_list : array(),
- 'editable' => $this->user->hasProjectAccess('subtask', 'edit', $project['id']),
- 'redirect' => 'task',
+ 'editable' => true,
)) ?>
<?= $this->render('tasklink/show', array(
'task' => $task,
'links' => $links,
'link_label_list' => $link_label_list,
- 'editable' => $this->user->hasProjectAccess('tasklink', 'edit', $project['id']),
+ 'editable' => true,
'is_public' => false,
)) ?>