UserController: Add links to add and delete users to the list action's view

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-20 13:53:19 +02:00
parent 539b824470
commit fecf7a52b0
2 changed files with 37 additions and 3 deletions

View File

@ -1,4 +1,9 @@
<?php if (! $this->compact): ?>
<?php
use Icinga\Data\Extensible;
use Icinga\Data\Reducible;
if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs; ?>
<?= $this->sortBox; ?>
@ -16,6 +21,9 @@
if ($backend === null) {
echo $this->translate('No backend found which is able to list users') . '</div>';
return;
} else {
$extensible = $backend instanceof Extensible;
$reducible = $backend instanceof Reducible;
}
if (! isset($users)) {
@ -36,6 +44,9 @@ if (count($users) === 0) {
<th class="user-state"><?= $this->translate('State'); ?></th>
<th class="user-created"><?= $this->translate('Created at'); ?></th>
<th class="user-modified"><?= $this->translate('Last modified'); ?></th>
<?php if ($reducible): ?>
<th class="user-remove"><?= $this->translate('Remove'); ?></th>
<?php endif ?>
</tr>
</thead>
<tbody>
@ -51,8 +62,31 @@ if (count($users) === 0) {
<td class="user-modified">
<?= $user->last_modified === null ? $this->translate('Never') : date('d/m/Y g:i A', $user->last_modified); ?>
</td>
<?php if ($reducible): ?>
<td class="user-remove">
<?= $this->qlink(
null,
'user/remove',
array(
'backend' => $backend->getName(),
'user' => $user->user_name
),
array(
'title' => sprintf($this->translate('Remove user %s'), $user->user_name),
'icon' => 'trash'
)
); ?>
</td>
<?php endif ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php if ($extensible): ?>
<?= $this->qlink($this->translate('Add a new user'), 'user/add', array('backend' => $backend->getName()), array(
'icon' => 'plus',
'data-base-target' => '_next',
'class' => 'user-add'
)); ?>
<?php endif ?>
</div>

View File

@ -205,7 +205,7 @@ table.benchmark {
table.user-list {
th {
&.user-state {
&.user-state, &.user-remove {
width: 6%;
padding-right: 0.5em;
text-align: right;
@ -218,7 +218,7 @@ table.user-list {
}
}
td.user-state, td.user-created, td.user-modified {
td.user-state, td.user-created, td.user-modified, td.user-remove {
text-align: right;
}
}