summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-04-18 15:14:52 -0400
committerFrederic Guillot <fred@kanboard.net>2015-04-18 15:14:52 -0400
commit93174162233890f6bdf3383e69095fc385f778aa (patch)
treefa50a39e85c7d29ce5fa88425a22b0a4c51c4880
parent54449d48c45b87699a796ca71b42c42a95dd9b8d (diff)
Fix position issues on column index template
-rw-r--r--app/Template/column/index.php87
1 files changed, 47 insertions, 40 deletions
diff --git a/app/Template/column/index.php b/app/Template/column/index.php
index d55aa3a8..e5772923 100644
--- a/app/Template/column/index.php
+++ b/app/Template/column/index.php
@@ -2,46 +2,53 @@
<h2><?= t('Edit the board for "%s"', $project['name']) ?></h2>
</div>
-<h3><?= t('Change columns') ?></h3>
-<table>
- <tr>
- <th><?= t('Column title') ?></th>
- <th><?= t('Task limit') ?></th>
- <th><?= t('Actions') ?></th>
- </tr>
- <?php foreach ($columns as $column): ?>
- <tr>
- <td class="column-60"><?= $this->e($column['title']) ?>
- <?php if (! empty($column['description'])): ?>
- <span class="column-tooltip" title='<?= $this->e($this->markdown($column['description'])) ?>'>
- <i class="fa fa-info-circle"></i>
- </span>
- <?php endif ?>
- </td>
- <td class="column-10"><?= $this->e($column['task_limit']) ?></td>
- <td class="column-30">
- <ul>
- <li>
- <?= $this->a(t('Edit'), 'column', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
- </li>
- <?php if ($column['position'] != 1): ?>
- <li>
- <?= $this->a(t('Move Up'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?>
- </li>
- <?php endif ?>
- <?php if ($column['position'] != count($columns)): ?>
- <li>
- <?= $this->a(t('Move Down'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?>
- </li>
- <?php endif ?>
- <li>
- <?= $this->a(t('Remove'), 'column', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
- </li>
- </ul>
- </td>
- </tr>
- <?php endforeach ?>
-</table>
+<?php if (! empty($columns)): ?>
+
+ <?php $first_position = $columns[0]['position']; ?>
+ <?php $last_position = $columns[count($columns) - 1]['position']; ?>
+
+ <h3><?= t('Change columns') ?></h3>
+ <table>
+ <tr>
+ <th><?= t('Column title') ?></th>
+ <th><?= t('Task limit') ?></th>
+ <th><?= t('Actions') ?></th>
+ </tr>
+ <?php foreach ($columns as $column): ?>
+ <tr>
+ <td class="column-60"><?= $this->e($column['title']) ?>
+ <?php if (! empty($column['description'])): ?>
+ <span class="column-tooltip" title='<?= $this->e($this->markdown($column['description'])) ?>'>
+ <i class="fa fa-info-circle"></i>
+ </span>
+ <?php endif ?>
+ </td>
+ <td class="column-10"><?= $this->e($column['task_limit']) ?></td>
+ <td class="column-30">
+ <ul>
+ <li>
+ <?= $this->a(t('Edit'), 'column', 'edit', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
+ </li>
+ <?php if ($column['position'] != $first_position): ?>
+ <li>
+ <?= $this->a(t('Move Up'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'up'), true) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($column['position'] != $last_position): ?>
+ <li>
+ <?= $this->a(t('Move Down'), 'column', 'move', array('project_id' => $project['id'], 'column_id' => $column['id'], 'direction' => 'down'), true) ?>
+ </li>
+ <?php endif ?>
+ <li>
+ <?= $this->a(t('Remove'), 'column', 'confirm', array('project_id' => $project['id'], 'column_id' => $column['id'])) ?>
+ </li>
+ </ul>
+ </td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+<?php endif ?>
<h3><?= t('Add a new column') ?></h3>
<form method="post" action="<?= $this->u('column', 'create', array('project_id' => $project['id'])) ?>" autocomplete="off">