Fix the config/resource-action's html markup

This commit is contained in:
Johannes Meyer 2014-07-23 12:55:43 +02:00
parent 9cdd891866
commit c8d61f78e7
2 changed files with 33 additions and 28 deletions

View File

@ -375,13 +375,15 @@ class ConfigController extends BaseConfigController
$this->render('authentication/remove');
}
public function resourceAction($showOnly = false)
/**
* Display all available resources and a link to create a new one
*/
public function resourceAction()
{
$this->view->messageBox = new AlertMessageBox(true);
$this->view->tabs->activate('resources');
$this->view->messageBox = new AlertMessageBox(true);
$this->view->resources = IcingaConfig::app('resources', true)->toArray();
$this->render('resource');
}
public function createresourceAction()

View File

@ -1,30 +1,33 @@
<div class="controls">
<?= $this->tabs ?>
<?= $tabs; ?>
</div>
<div class="content" data-base-target="_next">
<?php
if (isset($this->messageBox)) {
// TODO: Get rid of messageBoxes in favour of notifications
echo $this->messageBox->render();
}
?>
<p><a href="<?= $this->href('/config/createresource') ?>"><?= $this->icon('create.png'); ?> Create A New Resource</a></p>
<table class="action">
<thead>
<th>Resource</th>
<th style="width: 5em">Remove</th>
</thead>
<tbody>
<?= $messageBox; ?>
<p>
<a href="<?= $this->href('/config/createresource') ?>">
<?= $this->icon('create.png'); ?> <?= $this->translate('Create a new resource'); ?>
</a>
</p>
<table class="action">
<thead>
<th><?= $this->translate('Resource'); ?></th>
<th style="width: 5em"><?= $this->translate('Remove'); ?></th>
</thead>
<tbody>
<?php foreach ($this->resources as $name => $resource): ?>
<tr>
<td><a href="<?= $this->href('config/editresource', array('resource' => $name)) ?>"><?= $this->icon('edit.png') ?> <?= $this->escape($name); ?></td>
<td style="text-align: center"><a href="<?= $this->href('config/removeresource', array('resource' => $name)) ?>"><?= $this->icon('remove.png'); ?></a></td>
</tr>
<tr>
<td>
<a href="<?= $this->href('config/editresource', array('resource' => $name)) ?>">
<?= $this->icon('edit.png') ?> <?= $this->escape($name); ?>
</a>
</td>
<td style="text-align: center">
<a href="<?= $this->href('config/removeresource', array('resource' => $name)) ?>">
<?= $this->icon('remove.png'); ?>
</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</tbody>
</table>
</div>