Add tab for remove resource

refs #5543
This commit is contained in:
Eric Lippmann 2015-10-01 00:06:37 +02:00
parent f960874dd4
commit 2bc7e4a5ff
2 changed files with 8 additions and 4 deletions

View File

@ -19,6 +19,7 @@ use Icinga\Forms\ConfirmRemovalForm;
use Icinga\Security\SecurityException; use Icinga\Security\SecurityException;
use Icinga\Web\Controller; use Icinga\Web\Controller;
use Icinga\Web\Notification; use Icinga\Web\Notification;
use Icinga\Web\Url;
use Icinga\Web\Widget; use Icinga\Web\Widget;
/** /**
@ -381,6 +382,10 @@ class ConfigController extends Controller
public function removeresourceAction() public function removeresourceAction()
{ {
$this->assertPermission('config/application/resources'); $this->assertPermission('config/application/resources');
$this->getTabs()->add('resources/remove', array(
'label' => $this->translate('Remove Resource'),
'url' => Url::fromRequest()
))->activate('resources/remove');
$form = new ConfirmRemovalForm(array( $form = new ConfirmRemovalForm(array(
'onSuccess' => function ($form) { 'onSuccess' => function ($form) {
$configForm = new ResourceConfigForm(); $configForm = new ResourceConfigForm();
@ -401,7 +406,6 @@ class ConfigController extends Controller
} }
} }
)); ));
$form->setTitle($this->translate('Remove Existing Resource'));
$form->setRedirectUrl('config/resource'); $form->setRedirectUrl('config/resource');
$form->handleRequest(); $form->handleRequest();

View File

@ -1,6 +1,6 @@
<div class="controls"> <div class="controls">
<?= $this->tabs->showOnlyCloseButton() ?> <?= $tabs ?>
</div> </div>
<div class="content"> <div class="content">
<?= $form; ?> <?= $form ?>
</div> </div>