Avoid sub-tables when showing comments or downtimes in the detail view

fixes #8625
This commit is contained in:
Johannes Meyer 2015-03-13 08:32:39 +01:00
parent e36c430bb3
commit 99610bc1bd
4 changed files with 40 additions and 48 deletions

View File

@ -17,7 +17,7 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
*/
public function init()
{
$this->setAttrib('class', 'inline link-like');
$this->setAttrib('class', 'inline');
}
/**
@ -31,12 +31,16 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
'hidden',
'comment_id',
array(
'required' => true
'required' => true,
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'redirect'
'redirect',
array(
'decorators' => array('ViewHelper')
)
)
));
return $this;
@ -49,11 +53,14 @@ class DeleteCommentCommandForm extends ObjectsCommandForm
public function addSubmitButton()
{
$this->addElement(
'submit',
'button',
'btn_submit',
array(
'ignore' => true,
'label' => 'X',
'escape' => false,
'type' => 'submit',
'class' => 'link-like',
'label' => $this->getView()->icon('trash'),
'title' => $this->translate('Delete this comment'),
'decorators' => array('ViewHelper')
)

View File

@ -17,7 +17,7 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
*/
public function init()
{
$this->setAttrib('class', 'inline link-like');
$this->setAttrib('class', 'inline');
}
/**
@ -31,12 +31,16 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
'hidden',
'downtime_id',
array(
'required' => true
'required' => true,
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'redirect'
'redirect',
array(
'decorators' => array('ViewHelper')
)
)
));
return $this;
@ -49,11 +53,14 @@ class DeleteDowntimeCommandForm extends ObjectsCommandForm
public function addSubmitButton()
{
$this->addElement(
'submit',
'button',
'btn_submit',
array(
'ignore' => true,
'label' => 'X',
'escape' => false,
'type' => 'submit',
'class' => 'link-like',
'label' => $this->getView()->icon('trash'),
'title' => $this->translate('Delete this downtime'),
'decorators' => array('ViewHelper')
)

View File

@ -43,26 +43,15 @@ foreach ($object->comments as $comment) {
) : $this->escape($comment->comment);
?>
<tr>
<th><?= $this->escape($comment->author) ?> (<?= $this->timeSince($comment->timestamp) ?>)</th>
<td>
<table>
<tr>
<td style="vertical-align: top;" data-base-target="_self">
<?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
$delCommentForm = clone $delCommentForm;
$delCommentForm->populate(array('comment_id' => $comment->id));
echo $delCommentForm;
} ?>
(<?= ucfirst($comment->type) ?>):
</td>
<td style="padding-left: .5em;">
<?= nl2br($commentText) ?>
</td>
</tr>
</table>
<th><?= $this->escape($comment->author); ?> (<?= $this->timeSince($comment->timestamp); ?>)</th>
<td data-base-target="_self">
<?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
$delCommentForm = clone $delCommentForm;
$delCommentForm->populate(array('comment_id' => $comment->id));
echo $delCommentForm;
} ?>
<span class="sr-only">(<?= $this->translate('Comment'); ?>): </span><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
</td>
</tr>
<?php } // endforeach ?>

View File

@ -57,26 +57,15 @@ foreach ($object->downtimes as $downtime) {
}
?>
<tr>
<th><?= $this->escape($downtime->author) ?></th>
<td>
<table>
<tr>
<td style="vertical-align: top;" data-base-target="_self">
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
$delDowntimeForm = clone $delDowntimeForm;
$delDowntimeForm->populate(array('downtime_id' => $downtime->id));
echo $delDowntimeForm;
} ?>
<?= $state ?>
</td>
<td style="padding-left: .5em;">
<?= nl2br($commentText) ?>
</td>
</tr>
</table>
<th><?= $this->escape($downtime->author); ?></th>
<td data-base-target="_self">
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
$delDowntimeForm = clone $delDowntimeForm;
$delDowntimeForm->populate(array('downtime_id' => $downtime->id));
echo $delDowntimeForm;
} ?>
<span class="sr-only"><?= $this->translate('Downtime'); ?></span><?= $state; ?><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
</td>
</tr>
<?php } // endforeach ?>