diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-04-18 15:10:40 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-04-18 15:10:40 -0400 |
commit | 54449d48c45b87699a796ca71b42c42a95dd9b8d (patch) | |
tree | 54203609ffa90ff9a942e50478bceeba42df7acc /app/Template/subtask/show.php | |
parent | 7b7ea56460f755e77194b969c40a38c557ed08f6 (diff) |
Fix bug when moving subtasks with non consecutive positions
Diffstat (limited to 'app/Template/subtask/show.php')
-rw-r--r-- | app/Template/subtask/show.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/Template/subtask/show.php b/app/Template/subtask/show.php index c7ac652a..e5368265 100644 --- a/app/Template/subtask/show.php +++ b/app/Template/subtask/show.php @@ -1,4 +1,8 @@ <?php if (! empty($subtasks)): ?> + +<?php $first_position = $subtasks[0]['position']; ?> +<?php $last_position = $subtasks[count($subtasks) - 1]['position']; ?> + <div id="subtasks" class="task-show-section"> <div class="page-header"> @@ -40,12 +44,12 @@ <?php if (! isset($not_editable)): ?> <td> <ul> - <?php if ($subtask['position'] > 1): ?> + <?php if ($subtask['position'] != $first_position): ?> <li> <?= $this->a(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'] != 0 && $subtask['position'] != count($subtasks)): ?> + <?php if ($subtask['position'] != $last_position): ?> <li> <?= $this->a(t('Move Down'), 'subtask', 'movePosition', array('project_id' => $project['id'], 'task_id' => $subtask['task_id'], 'subtask_id' => $subtask['id'], 'direction' => 'down'), true) ?> </li> |