summaryrefslogtreecommitdiff
path: root/app/Template/subtask
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-19 22:59:47 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-19 22:59:47 -0500
commitde4519fa2c45ca96d4bf0b9ce288cad600d09854 (patch)
tree9e66f936c8c82f32332cf74c24ca235dda5cd47b /app/Template/subtask
parent270e0835b2f1b6de2c84d2cb1b7596d5babb6c2f (diff)
Add subtasks drag and drop
Diffstat (limited to 'app/Template/subtask')
-rw-r--r--app/Template/subtask/menu.php10
-rw-r--r--app/Template/subtask/show.php2
-rw-r--r--app/Template/subtask/table.php13
3 files changed, 11 insertions, 14 deletions
diff --git a/app/Template/subtask/menu.php b/app/Template/subtask/menu.php
index 16174bcf..6c98b951 100644
--- a/app/Template/subtask/menu.php
+++ b/app/Template/subtask/menu.php
@@ -1,16 +1,6 @@
<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['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'up', 'redirect' => $redirect), true) ?>
- </li>
- <?php endif ?>
- <?php if ($subtask['position'] != $last_position): ?>
- <li>
- <?= $this->url->link(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $task['project_id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down', 'redirect' => $redirect), 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>
diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php
index bd999496..b0326c48 100644
--- a/app/Template/subtask/show.php
+++ b/app/Template/subtask/show.php
@@ -4,7 +4,7 @@
<div id="subtasks">
- <?= $this->render('subtask/table', array('subtasks' => $subtasks, 'task' => $task, 'editable' => $editable, 'redirect' => $redirect)) ?>
+ <?= $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
index 8ad9664c..53902057 100644
--- a/app/Template/subtask/table.php
+++ b/app/Template/subtask/table.php
@@ -3,7 +3,11 @@
<?php $first_position = $subtasks[0]['position']; ?>
<?php $last_position = $subtasks[count($subtasks) - 1]['position']; ?>
- <table class="subtasks-table">
+ <table
+ class="subtasks-table table-stripped"
+ data-save-position-url="<?= $this->url->href('Subtask', 'movePosition', array('project_id' => $task['project_id'], 'task_id' => $task['id'])) ?>"
+ >
+ <thead>
<tr>
<th class="column-40"><?= t('Title') ?></th>
<th><?= t('Assignee') ?></th>
@@ -12,10 +16,13 @@
<th class="column-5"></th>
<?php endif ?>
</tr>
+ </thead>
+ <tbody>
<?php foreach ($subtasks as $subtask): ?>
- <tr>
+ <tr data-subtask-id="<?= $subtask['id'] ?>">
<td>
<?php if ($editable): ?>
+ <i class="fa fa-arrows-alt draggable-row-handle" title="<?= t('Move subtask position') ?>"></i>
<?= $this->subtask->toggleStatus($subtask, $task['project_id'], true) ?>
<?php else: ?>
<?= $this->subtask->getTitle($subtask) ?>
@@ -58,12 +65,12 @@
'subtask' => $subtask,
'first_position' => $first_position,
'last_position' => $last_position,
- 'redirect' => $redirect,
)) ?>
</td>
<?php endif ?>
</tr>
<?php endforeach ?>
+ </tbody>
</table>
<?php else: ?>
<p class="alert"><?= t('There is no subtask at the moment.') ?></p>