瀏覽代碼

HUE-7743 [frontend] Make sure modals open correctly in embedded mode

Johan Ahlen 8 年之前
父節點
當前提交
842db9e7d1

文件差異過大導致無法顯示
+ 0 - 0
desktop/core/src/desktop/static/desktop/css/hue-embedded.css


+ 5 - 0
desktop/core/src/desktop/static/desktop/less/hue-embedded.less

@@ -36,6 +36,11 @@
     z-index: auto;
   }
 
+  .modal {
+    right: auto;
+    bottom: auto;
+  }
+
   * {
     box-sizing: content-box;
   }

+ 16 - 0
desktop/core/src/desktop/templates/hue.mako

@@ -89,6 +89,22 @@
 % endif
   <script type="text/javascript">
     window.IS_HUE_4 = true;
+% if IS_EMBEDDED.get():
+  // Bootstrap 2.3.2 relies on the hide css class presence for modals but doesn't remove it when opened for fade type
+  // modals, a parent container might have it set to !important which will prevent the modal from showing. This
+  // redefines all .hide definitions to exclude .modal.fade
+  for (var i = 0; i < document.styleSheets.length; i++) {
+    for (var j = document.styleSheets[i].cssRules.length - 1; j > 0; j--) {
+      if (document.styleSheets[i].cssRules[j].selectorText === '.hide') {
+        var originalCssText = document.styleSheets[i].cssRules[j].cssText;
+        if (originalCssText.indexOf('!important') !== -1) {
+          document.styleSheets[i].deleteRule(j);
+          document.styleSheets[i].insertRule(originalCssText.replace('.hide', '.hide:not(.modal):not(.fade)'));
+        }
+      }
+    }
+  }
+% endif
   </script>
 
   ${ commonHeaderFooterComponents.header_i18n_redirection() }

部分文件因文件數量過多而無法顯示