Make delete action in the comment and dowtime list view accessible

fixes #11883
This commit is contained in:
Eric Lippmann 2016-06-02 17:23:38 +02:00
parent 3978d70127
commit 4c2b7f4377
2 changed files with 17 additions and 2 deletions

View File

@ -43,6 +43,10 @@
$this->formatTime($comment->expiration)
)) : '' ?>
<?php if (isset($delCommentForm)) {
// Form is unset if the current user lacks the respective permission
$uniqId = uniqid();
$buttonId = 'delete-comment-' . $uniqId;
$textId = 'comment-' . $uniqId;
$deleteButton = clone $delCommentForm;
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm $deleteButton */
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action');
@ -52,10 +56,14 @@
'comment_is_service' => isset($comment->service_description)
)
);
$deleteButton->getElement('btn_submit')
->setAttrib('aria-label', $this->translate('Delete comment'))
->setAttrib('id', $buttonId)
->setAttrib('aria-describedby', $buttonId . ' ' . $textId);
echo $deleteButton;
} ?>
</span>
</div>
<p class="comment-text">
<p class="comment-text"<?php if (isset($textId)): ?> id="<?= $textId ?>"<?php endif ?>>
<?= $this->nl2br($this->escapeComment($comment->comment)) ?>
</p>

View File

@ -53,6 +53,9 @@
<?php if (isset($delDowntimeForm)) {
// Form is unset if the current user lacks the respective permission
$uniqId = uniqid();
$buttonId = 'delete-downtime-' . $uniqId;
$textId = 'downtime-' . $uniqId;
$deleteButton = clone $delDowntimeForm;
/** @var \Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm $deleteButton */
$deleteButton->setAttrib('class', $deleteButton->getAttrib('class') . ' remove-action');
@ -62,11 +65,15 @@
'downtime_is_service' => isset($downtime->service_description)
)
);
$deleteButton->getElement('btn_submit')
->setAttrib('aria-label', $this->translate('Delete downtime'))
->setAttrib('id', $buttonId)
->setAttrib('aria-describedby', $buttonId . ' ' . $textId);
echo $deleteButton;
} ?>
</span>
</div>
<p class="comment-text">
<p class="comment-text"<?php if (isset($textId)): ?> id="<?= $textId ?>"<?php endif ?>>
<?= $this->nl2br($this->escapeComment($downtime->comment)) ?>
</p>
</td>