JS-less iFrame rendering improvements

This commit is contained in:
Thomas Gelf 2014-04-17 16:20:03 +00:00
parent 54175f98bf
commit 83b26bc595
2 changed files with 17 additions and 1 deletions

View File

@ -76,7 +76,7 @@ class Component extends AbstractWidget
<div class="container" data-icinga-url="{URL}"> <div class="container" data-icinga-url="{URL}">
<h1>{REMOVE}<a href="{FULL_URL}" data-base-target="col1">{TITLE}</a></h1> <h1>{REMOVE}<a href="{FULL_URL}" data-base-target="col1">{TITLE}</a></h1>
<noscript> <noscript>
<iframe src="{URL}" style="height:100%; width:99%" frameborder="no"></iframe> <iframe src="{IFRAME_URL}" style="height:100%; width:99%" frameborder="no"></iframe>
</noscript> </noscript>
</div> </div>
EOD; EOD;
@ -165,8 +165,11 @@ EOD;
$view = $this->view(); $view = $this->view();
$url = clone($this->url); $url = clone($this->url);
$url->addParams(array('view' => 'compact')); $url->addParams(array('view' => 'compact'));
$iframeUrl = clone($url);
$iframeUrl->addParams(array('_render' => 'iframe'));
$html = str_replace('{URL}', $url, $this->template); $html = str_replace('{URL}', $url, $this->template);
$html = str_replace('{IFRAME_URL}', $iframeUrl, $html);
$html = str_replace('{FULL_URL}', $url->getUrlWithout('view'), $html); $html = str_replace('{FULL_URL}', $url->getUrlWithout('view'), $html);
$html = str_replace('{REMOVE_BTN}', $this->getRemoveForm($view), $html); $html = str_replace('{REMOVE_BTN}', $this->getRemoveForm($view), $html);
$html = str_replace('{TITLE}', $view->escape($this->getTitle()), $html); $html = str_replace('{TITLE}', $view->escape($this->getTitle()), $html);
@ -181,6 +184,8 @@ EOD;
*/ */
protected function getRemoveForm() protected function getRemoveForm()
{ {
// TODO: temporarily disabled, should point to a form asking for confirmal
return '';
$removeUrl = Url::fromPath( $removeUrl = Url::fromPath(
'/dashboard/removecomponent', '/dashboard/removecomponent',
array( array(

View File

@ -35,6 +35,17 @@ html {
bottom: 0; bottom: 0;
} }
.iframe {
#header, #sidebar {
display: none;
}
#main {
left: 0;
top: 0;
}
}
#responsive-debug { #responsive-debug {
font-size: 0.9em; font-size: 0.9em;
font-family: Courier new, monospace; font-family: Courier new, monospace;