diff --git a/lizmap_server/get_feature_info.py b/lizmap_server/get_feature_info.py index 028521b9..6b97a25d 100755 --- a/lizmap_server/get_feature_info.py +++ b/lizmap_server/get_feature_info.py @@ -80,7 +80,13 @@ def append_maptip(cls, string: str, layer_name: str, feature_id: Union[str, int] @classmethod def feature_list_to_replace( - cls, cfg: dict, project: QgsProject, relation_manager: QgsRelationManager, xml: str) -> List[Result]: + cls, + cfg: dict, + project: QgsProject, + relation_manager: QgsRelationManager, + xml: str, + bootstrap_5: bool, + ) -> List[Result]: """ Parse the XML and check for each layer according to the Lizmap CFG file. """ features = [] for layer_name, feature_id in GetFeatureInfoFilter.parse_xml(xml): @@ -120,7 +126,8 @@ def feature_list_to_replace( root = config.invisibleRootContainer() # Need to eval the html_content - html_content = Tooltip.create_popup_node_item_from_form(layer, root, 0, [], '', relation_manager) + html_content = Tooltip.create_popup_node_item_from_form( + layer, root, 0, [], '', relation_manager, bootstrap_5) html_content = Tooltip.create_popup(html_content) # Maybe we can avoid the CSS on all features ? @@ -175,9 +182,11 @@ def responseComplete(self): xml = request.body().data().decode("utf-8") + bootstrap_5 = params.get('CSS_FRAMEWORK', '').upper() == 'BOOTSTRAP5' + # noinspection PyBroadException try: - features = self.feature_list_to_replace(cfg, project, relation_manager, xml) + features = self.feature_list_to_replace(cfg, project, relation_manager, xml, bootstrap_5) except Exception as e: if to_bool(os.getenv("CI")): logger.log_exception(e) diff --git a/lizmap_server/tooltip.py b/lizmap_server/tooltip.py index 85919526..5e930af2 100755 --- a/lizmap_server/tooltip.py +++ b/lizmap_server/tooltip.py @@ -60,6 +60,7 @@ def create_popup_node_item_from_form( headers: list, html: str, relation_manager: QgsRelationManager, + bootstrap_5: bool = False, ) -> str: regex = re.compile(r"[^a-zA-Z0-9_]", re.IGNORECASE) a = '' @@ -173,9 +174,22 @@ def create_popup_node_item_from_form( if visibility and not active: active = visibility h += '\n' + SPACES - h += ( - '