object/render: allow to render resolved object

This commit is contained in:
Thomas Gelf 2016-02-28 14:15:56 +01:00
parent 4dde0eaaf6
commit 466b32ba2e
2 changed files with 33 additions and 2 deletions

View File

@ -1,6 +1,9 @@
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
<span>
<?= $this->actionLinks ?>
</span>
</div>
<div class="content">

View File

@ -75,10 +75,38 @@ abstract class ObjectController extends ActionController
{
$type = $this->getType();
$this->getTabs()->activate('render');
$this->view->object = $this->object;
$object = $this->object;
if ($this->params->shift('resolved')) {
$this->view->object = $object::fromPlainObject(
$object->toPlainObject(true),
$object->getConnection()
);
if ($object->imports()->count() > 0) {
$this->view->actionLinks = $this->view->qlink(
$this->translate('Show normal'),
$this->getRequest()->getUrl()->without('resolved'),
null,
array('class' => 'icon-resize-small state-warning')
);
}
} else {
$this->view->object = $object;
if ($object->imports()->count() > 0) {
$this->view->actionLinks = $this->view->qlink(
$this->translate('Show resolved'),
$this->getRequest()->getUrl()->with('resolved', true),
null,
array('class' => 'icon-resize-full')
);
}
}
$this->view->title = sprintf(
$this->translate('Config preview: %s'),
$this->object->object_name
$object->object_name
);
$this->render('object/show', null, true);
}