customvars.phtml: Collapse custom variables if they exceed 5 rows

Also collapses customvar values if they're JSON blobs and exceed
5 rows.

refs #3566
This commit is contained in:
Johannes Meyer 2019-07-18 14:10:40 +02:00
parent f42a49d4a9
commit 226b58ac9d
2 changed files with 5 additions and 1 deletions

View File

@ -34,9 +34,11 @@ class Zend_View_Helper_Customvar extends Zend_View_Helper_Abstract
return '[]'; return '[]';
} }
$out = "<ul>\n"; $out = "<ul>\n";
foreach ($array as $val) { foreach ($array as $val) {
$out .= '<li>' . $this->customvar($val) . "</li>\n"; $out .= '<li>' . $this->customvar($val) . "</li>\n";
} }
return $out . "</ul>\n"; return $out . "</ul>\n";
} }
@ -46,6 +48,7 @@ class Zend_View_Helper_Customvar extends Zend_View_Helper_Abstract
return '{}'; return '{}';
} }
$out = "{<ul>\n"; $out = "{<ul>\n";
foreach ($object as $key => $val) { foreach ($object as $key => $val) {
$out .= '<li>' $out .= '<li>'
. $this->view->escape($key) . $this->view->escape($key)
@ -53,6 +56,7 @@ class Zend_View_Helper_Customvar extends Zend_View_Helper_Abstract
. $this->customvar($val) . $this->customvar($val)
. "</li>\n"; . "</li>\n";
} }
return $out . "</ul>}"; return $out . "</ul>}";
} }
} }

View File

@ -43,7 +43,7 @@
<?php if (! empty($object->customvars)): ?> <?php if (! empty($object->customvars)): ?>
<h2><?= $this->translate('Custom Variables') ?></h2> <h2><?= $this->translate('Custom Variables') ?></h2>
<table class="name-value-table"> <table id="<?= $object->type ?>-customvars" class="name-value-table collapsible" data-visible-height="200">
<tbody> <tbody>
<?= $this->render('show/components/customvars.phtml') ?> <?= $this->render('show/components/customvars.phtml') ?>
</tbody> </tbody>