From 9f4330a9bd6ecbdb6f6ea8380d42d4ef7ded8f74 Mon Sep 17 00:00:00 2001
From: David Siegfried <david.siegfried@uni-vechta.de>
Date: Sat, 11 Mar 2023 12:05:15 +0000
Subject: [PATCH] remove useless whitespace, closes #2340

Closes #2340

Merge request studip/studip!1530
---
 .../resources/_common/_resource_tree_item.php      | 14 ++++++++------
 resources/assets/stylesheets/scss/article.scss     |  7 +++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/app/views/resources/_common/_resource_tree_item.php b/app/views/resources/_common/_resource_tree_item.php
index 204aa2e7930..a3db8665b77 100644
--- a/app/views/resources/_common/_resource_tree_item.php
+++ b/app/views/resources/_common/_resource_tree_item.php
@@ -1,8 +1,8 @@
 <?php
-$children = $resource->children;
+$children     = $resource->children;
 $has_children = count($children) > 0;
 ?>
-<article class="studip <?= $has_children ? 'toggle' : ''?> <?= $open ? 'open' : ''?>">
+<article class="studip <?= $has_children ? 'toggle' : ((string)$resource->description === '' ? 'empty' : '') ?> <?= $open ? 'open' : '' ?>">
     <header>
         <h1>
             <a href="#"><?= htmlReady($resource->getFullName()) ?></a>
@@ -18,14 +18,16 @@ $has_children = count($children) > 0;
                     'resources/_common/_resource_tree_item',
                     [
                         'resource' => $child,
-                        'open' => false
+                        'open'     => false
                     ]
                 ) ?>
             <? endforeach ?>
         </section>
     <? else : ?>
-        <section>
-            <?= htmlReady($resource->description) ?>
-        </section>
+        <? if ((string)$resource->description !== '') : ?>
+            <section>
+                <?= htmlReady($resource->description) ?>
+            </section>
+        <? endif ?>
     <? endif ?>
 </article>
diff --git a/resources/assets/stylesheets/scss/article.scss b/resources/assets/stylesheets/scss/article.scss
index e9be1580293..15c968f77f1 100644
--- a/resources/assets/stylesheets/scss/article.scss
+++ b/resources/assets/stylesheets/scss/article.scss
@@ -81,6 +81,13 @@ article.studip {
         }
     }
 
+    &.empty {
+        > header {
+            margin-bottom: 0;
+        }
+        padding-bottom: 0;
+    }
+
     &.toggle {
         > header {
             h1 > a {
-- 
GitLab