From 2d0c796aabd52426ca68c037b9148c83856a9fa7 Mon Sep 17 00:00:00 2001
From: Ron Lucke <lucke@elan-ev.de>
Date: Thu, 12 Dec 2024 09:50:46 +0000
Subject: [PATCH] Loginseite: FAQ-Box kann beliebig hoch werden

Closes #4998

Merge request studip/studip!3753
---
 resources/assets/stylesheets/scss/index.scss |  1 +
 templates/loginform.php                      | 22 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/resources/assets/stylesheets/scss/index.scss b/resources/assets/stylesheets/scss/index.scss
index c698014223b..b33d5f6f9b8 100644
--- a/resources/assets/stylesheets/scss/index.scss
+++ b/resources/assets/stylesheets/scss/index.scss
@@ -122,6 +122,7 @@ $gap-between-boxes: calc($login-page-margin / 2);
 
     #login-faq-content-wrapper {
         height: calc(100% - 32px);
+        max-height: 430px;
     }
 
     .login-box-header {
diff --git a/templates/loginform.php b/templates/loginform.php
index ef831d98cda..ec2289956f5 100644
--- a/templates/loginform.php
+++ b/templates/loginform.php
@@ -137,6 +137,28 @@ $enable_news = Config::get()->LOGIN_NEWS_VISIBILITY && count($news_entries) > 0;
     });
     // -->
 
+    <? if ($enable_faq) : ?>
+        STUDIP.domReady(() => {
+            const loginBox = document.getElementById('loginbox');
+            const faqContent = document.getElementById('login-faq-content-wrapper');
+            const htmlTag = document.documentElement;
+
+            const adjustFaqHeight = () => {
+                if (!htmlTag.classList.contains('responsive-display')) {
+                    const loginBoxHeight = loginBox.offsetHeight;
+
+                    const maxAllowedHeight = loginBoxHeight - 100;
+
+                    faqContent.style.maxHeight = `${Math.max(maxAllowedHeight, 0)}px`;
+                }
+            };
+
+            adjustFaqHeight();
+
+            window.addEventListener('resize', adjustFaqHeight);
+        });
+    <? endif ?>
+
     <? if ($enable_faq && $enable_news): ?>
         const faqButton = document.getElementById('show-faq');
         const newsButton = document.getElementById('hide-faq');
-- 
GitLab