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

View File

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

View File

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

View File

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