From 4182a5af750dbb5b8d34cbdb3c725116521a392a Mon Sep 17 00:00:00 2001
From: Eric Lippmann <eric.lippmann@icinga.com>
Date: Tue, 16 Jan 2018 16:38:32 +0100
Subject: [PATCH] Improve rendering of iframes in the dashboard

---
 application/views/scripts/iframe/index.phtml |  6 +++++-
 public/css/icinga/main.less                  | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/application/views/scripts/iframe/index.phtml b/application/views/scripts/iframe/index.phtml
index 7f409d0f6..96e9de700 100644
--- a/application/views/scripts/iframe/index.phtml
+++ b/application/views/scripts/iframe/index.phtml
@@ -1,4 +1,8 @@
+<?php if (! $compact): ?>
 <div class="controls">
     <?= $tabs ?>
 </div>
-<iframe src="<?= $this->escape($url) ?>" style="height:99%; width:99%;" frameborder="no"></iframe>
\ No newline at end of file
+<?php endif ?>
+<div class="iframe-container">
+    <iframe src="<?= $this->escape($url) ?>" frameborder="no"></iframe>
+</div>
diff --git a/public/css/icinga/main.less b/public/css/icinga/main.less
index 98b8adabb..938dee3b9 100644
--- a/public/css/icinga/main.less
+++ b/public/css/icinga/main.less
@@ -215,3 +215,21 @@ a:hover > .icon-cancel {
   height: 100%;
   vertical-align: middle;
 }
+
+// Responsive iFrames
+
+.iframe-container {
+  position: relative;
+  height: 0;
+  overflow: hidden;
+  padding-bottom: 75%;
+  width: 100%;
+
+  & > iframe {
+    position: absolute;
+    left: 0;
+    top: 0;
+    height: 100%;
+    width: 100%;
+  }
+}