From dccfbe7b530576383ac9c5a1d4cacd5688052889 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Mon, 4 Dec 2023 11:09:42 +0000
Subject: [PATCH] fixes #3528

Closes #3528

Merge request studip/studip!2417
---
 app/views/course/dates/details-edit.php       | 176 +++++++++---------
 app/views/course/timesrooms/editDate.php      | 145 ++++++++-------
 .../stylesheets/scss/studip-selection.scss    |   8 -
 3 files changed, 165 insertions(+), 164 deletions(-)

diff --git a/app/views/course/dates/details-edit.php b/app/views/course/dates/details-edit.php
index 8991002e5af..2fec69cb07b 100644
--- a/app/views/course/dates/details-edit.php
+++ b/app/views/course/dates/details-edit.php
@@ -39,101 +39,105 @@
     </fieldset>
 
 <? if (count($teachers) > 1): ?>
-    <fieldset class="studip-selection <?= $metadata_locked ? 'disabled' : ''?>" data-attribute-name="assigned_teachers">
+    <fieldset>
         <legend><?= _('Durchführende Lehrende') ?></legend>
 
-        <section class="studip-selection-selected">
-            <h2><?= _('Zugewiesene Lehrende') ?></h2>
-
-            <ul>
-            <? foreach ($assigned_teachers as $teacher): ?>
-                <li data-selection-id="<?= htmlReady($teacher->user_id) ?>">
-                    <input type="hidden" name="assigned_teachers[]"
-                           value="<?= htmlReady($teacher->user_id) ?>">
-
-                    <span class="studip-selection-image">
-                        <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
-                    </span>
-                    <span class="studip-selection-label">
-                        <?= htmlReady($teacher->getFullname()) ?>
-                    </span>
-                </li>
+        <div class="studip-selection <?= $metadata_locked ? 'disabled' : ''?>" data-attribute-name="assigned_teachers">
+            <section class="studip-selection-selected">
+                <h2><?= _('Zugewiesene Lehrende') ?></h2>
+
+                <ul>
+                <? foreach ($assigned_teachers as $teacher): ?>
+                    <li data-selection-id="<?= htmlReady($teacher->user_id) ?>">
+                        <input type="hidden" name="assigned_teachers[]"
+                               value="<?= htmlReady($teacher->user_id) ?>">
+
+                        <span class="studip-selection-image">
+                            <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
+                        </span>
+                        <span class="studip-selection-label">
+                            <?= htmlReady($teacher->getFullname()) ?>
+                        </span>
+                    </li>
+                <? endforeach; ?>
+                    <li class="empty-placeholder">
+                        <?= _('Kein spezieller Lehrender zugewiesen') ?>
+                    </li>
+                </ul>
+            </section>
+
+            <section class="studip-selection-selectable">
+                <h2><?= _('Lehrende der Veranstaltung') ?></h2>
+
+                <ul>
+            <? foreach ($teachers as $teacher): ?>
+                <? if (!$assigned_teachers->find($teacher->user_id)): ?>
+                    <li data-selection-id="<?= htmlReady($teacher->id) ?>" >
+                        <span class="studip-selection-image">
+                            <?= Avatar::getAvatar($teacher->id)->getImageTag(Avatar::SMALL) ?>
+                        </span>
+                        <span class="studip-selection-label">
+                            <?= htmlReady($teacher->getFullname()) ?>
+                        </span>
+                    </li>
+                <? endif; ?>
             <? endforeach; ?>
-                <li class="empty-placeholder">
-                    <?= _('Kein spezieller Lehrender zugewiesen') ?>
-                </li>
-            </ul>
-        </section>
-
-        <section class="studip-selection-selectable">
-            <h2><?= _('Lehrende der Veranstaltung') ?></h2>
-
-            <ul>
-        <? foreach ($teachers as $teacher): ?>
-            <? if (!$assigned_teachers->find($teacher->user_id)): ?>
-                <li data-selection-id="<?= htmlReady($teacher->id) ?>" >
-                    <span class="studip-selection-image">
-                        <?= Avatar::getAvatar($teacher->id)->getImageTag(Avatar::SMALL) ?>
-                    </span>
-                    <span class="studip-selection-label">
-                        <?= htmlReady($teacher->getFullname()) ?>
-                    </span>
-                </li>
-            <? endif; ?>
-        <? endforeach; ?>
-                <li class="empty-placeholder">
-                    <?= sprintf(
-                            _('Ihre Auswahl entspricht dem Zustand "%s" und wird beim Speichern zurückgesetzt'),
-                            _('Kein spezieller Lehrender zugewiesen')
-                    ) ?>
-                </li>
-            </ul>
-        </section>
+                    <li class="empty-placeholder">
+                        <?= sprintf(
+                                _('Ihre Auswahl entspricht dem Zustand "%s" und wird beim Speichern zurückgesetzt'),
+                                _('Kein spezieller Lehrender zugewiesen')
+                        ) ?>
+                    </li>
+                </ul>
+            </section>
+        </div>
     </fieldset>
 <? endif; ?>
 
 <? if (count($groups) > 0): ?>
-    <fieldset class="studip-selection <?= $metadata_locked ? 'disabled' : ''?>" data-attribute-name="assigned_groups">
+    <fieldset>
         <legend><?= _('Beteiligte Gruppen') ?></legend>
 
-        <section class="studip-selection-selected">
-            <h2><?= _('Zugewiesene Gruppen') ?></h2>
-
-            <ul>
-            <? foreach ($assigned_groups as $group) : ?>
-                <li data-selection-id="<?= htmlReady($group->id) ?>">
-                    <input type="hidden" name="assigned_groups[]"
-                           value="<?= htmlReady($group->id) ?>">
-
-                    <span class="studip-selection-label">
-                        <?= htmlReady($group->name) ?>
-                    </span>
-                </li>
-            <? endforeach ?>
-                <li class="empty-placeholder">
-                    <?= _('Keine spezielle Gruppe zugewiesen') ?>
-                </li>
-            </ul>
-        </section>
-
-        <section class="studip-selection-selectable">
-            <h2><?= _('Gruppen der Veranstaltung') ?></h2>
-
-            <ul>
-        <? foreach ($groups as $group): ?>
-            <? if (!$assigned_groups->find($group->id)): ?>
-                <li data-selection-id="<?= htmlReady($group->id) ?>" >
-                    <span class="studip-selection-label">
-                        <?= htmlReady($group->name) ?>
-                    </span>
-                </li>
-            <? endif; ?>
-        <? endforeach; ?>
-                <li class="empty-placeholder">
-                    <?= _('Alle Gruppen wurden dem Termin zugewiesen') ?>
-                </li>
-            </ul>
-        </section>
+        <div class="studip-selection <?= $metadata_locked ? 'disabled' : ''?>" data-attribute-name="assigned_groups">
+            <section class="studip-selection-selected">
+                <h2><?= _('Zugewiesene Gruppen') ?></h2>
+
+                <ul>
+                <? foreach ($assigned_groups as $group) : ?>
+                    <li data-selection-id="<?= htmlReady($group->id) ?>">
+                        <input type="hidden" name="assigned_groups[]"
+                               value="<?= htmlReady($group->id) ?>">
+
+                        <span class="studip-selection-label">
+                            <?= htmlReady($group->name) ?>
+                        </span>
+                    </li>
+                <? endforeach ?>
+                    <li class="empty-placeholder">
+                        <?= _('Keine spezielle Gruppe zugewiesen') ?>
+                    </li>
+                </ul>
+            </section>
+
+            <section class="studip-selection-selectable">
+                <h2><?= _('Gruppen der Veranstaltung') ?></h2>
+
+                <ul>
+            <? foreach ($groups as $group): ?>
+                <? if (!$assigned_groups->find($group->id)): ?>
+                    <li data-selection-id="<?= htmlReady($group->id) ?>" >
+                        <span class="studip-selection-label">
+                            <?= htmlReady($group->name) ?>
+                        </span>
+                    </li>
+                <? endif; ?>
+            <? endforeach; ?>
+                    <li class="empty-placeholder">
+                        <?= _('Alle Gruppen wurden dem Termin zugewiesen') ?>
+                    </li>
+                </ul>
+            </section>
+        </div>
     </fieldset>
 <? endif; ?>
 
diff --git a/app/views/course/timesrooms/editDate.php b/app/views/course/timesrooms/editDate.php
index 695559ab914..13a699ada9b 100644
--- a/app/views/course/timesrooms/editDate.php
+++ b/app/views/course/timesrooms/editDate.php
@@ -114,96 +114,101 @@
     </fieldset>
 
 <? if (count($teachers) > 1): ?>
-    <fieldset class="collapsed studip-selection" data-attribute-name="assigned_teachers">
+    <fieldset class="collapsed">
         <legend><?= _('Durchführende Lehrende') ?></legend>
 
-        <section class="studip-selection-selected">
-            <p><strong><?= _('Zugewiesene Lehrende') ?></strong></p>
-            <ul>
-            <? foreach ($assigned_teachers as $teacher): ?>
-                <li data-selection-id="<?= htmlReady($teacher->user_id) ?>">
-                    <input type="hidden" name="assigned_teachers[]"
-                           value="<?= htmlReady($teacher->user_id) ?>">
+        <div class="studip-selection" data-attribute-name="assigned_teachers">
+            <section class="studip-selection-selected">
+                <p><strong><?= _('Zugewiesene Lehrende') ?></strong></p>
+                <ul>
+                <? foreach ($assigned_teachers as $teacher): ?>
+                    <li data-selection-id="<?= htmlReady($teacher->user_id) ?>">
+                        <input type="hidden" name="assigned_teachers[]"
+                               value="<?= htmlReady($teacher->user_id) ?>">
 
-                    <span class="studip-selection-image">
-                        <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
-                    </span>
-                    <span class="studip-selection-label">
-                        <?= htmlReady($teacher->getFullname()) ?>
-                    </span>
-                </li>
-            <? endforeach ?>
-                <li class="empty-placeholder">
-                    <?= _('Kein spezieller Lehrender zugewiesen') ?>
-                </li>
-            </ul>
-        </section>
-
-        <section class="studip-selection-selectable">
-            <p><strong><?= _('Lehrende der Veranstaltung') ?></strong></p>
-            <ul>
-            <? foreach ($teachers as $teacher): ?>
-                <? if (!$assigned_teachers->find($teacher->user_id)): ?>
-                    <li data-selection-id="<?= htmlReady($teacher->user_id) ?>" >
                         <span class="studip-selection-image">
                             <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
                         </span>
                         <span class="studip-selection-label">
-                            <?= htmlReady($teacher->getUserFullname()) ?>
+                            <?= htmlReady($teacher->getFullname()) ?>
                         </span>
                     </li>
-                <? endif ?>
-            <? endforeach ?>
-                <li class="empty-placeholder">
-                    <?= sprintf(
-                            _('Ihre Auswahl entspricht dem Zustand "%s" und wird beim Speichern zurückgesetzt'),
-                            _('Kein spezieller Lehrender zugewiesen')
-                    ) ?>
-                </li>
-            </ul>
-        </section>
+                <? endforeach ?>
+                    <li class="empty-placeholder">
+                        <?= _('Kein spezieller Lehrender zugewiesen') ?>
+                    </li>
+                </ul>
+            </section>
+
+            <section class="studip-selection-selectable">
+                <p><strong><?= _('Lehrende der Veranstaltung') ?></strong></p>
+                <ul>
+                <? foreach ($teachers as $teacher): ?>
+                    <? if (!$assigned_teachers->find($teacher->user_id)): ?>
+                        <li data-selection-id="<?= htmlReady($teacher->user_id) ?>" >
+                            <span class="studip-selection-image">
+                                <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
+                            </span>
+                            <span class="studip-selection-label">
+                                <?= htmlReady($teacher->getUserFullname()) ?>
+                            </span>
+                        </li>
+                    <? endif ?>
+                <? endforeach ?>
+                    <li class="empty-placeholder">
+                        <?= sprintf(
+                                _('Ihre Auswahl entspricht dem Zustand "%s" und wird beim Speichern zurückgesetzt'),
+                                _('Kein spezieller Lehrender zugewiesen')
+                        ) ?>
+                    </li>
+                </ul>
+            </section>
+        </div>
     </fieldset>
 <? endif ?>
 
 <? if (count($groups) > 0): ?>
-    <fieldset class="collapsed studip-selection" data-attribute-name="assigned_groups">
+    <fieldset class="collapsed">
         <legend><?= _('Beteiligte Gruppen') ?></legend>
-        <section class="studip-selection-selected">
-            <p><strong><?= _('Zugewiesene Gruppen') ?></strong></p>
-            <ul>
-                <? foreach ($assigned_groups as $group) : ?>
-                    <li data-selection-id="<?= htmlReady($group->id) ?>">
-                        <input type="hidden" name="assigned_groups[]"
-                               value="<?= htmlReady($group->id) ?>">
 
-                        <span class="studip-selection-label">
-                            <?= htmlReady($group->name) ?>
-                        </span>
-                    </li>
-                <? endforeach ?>
-                <li class="empty-placeholder">
-                    <?= _('Keine spezielle Gruppe zugewiesen') ?>
-                </li>
-            </ul>
-        </section>
+        <div class="studip-selection" data-attribute-name="assigned-groups">
+            <section class="studip-selection-selected">
+                <p><strong><?= _('Zugewiesene Gruppen') ?></strong></p>
+                <ul>
+                    <? foreach ($assigned_groups as $group) : ?>
+                        <li data-selection-id="<?= htmlReady($group->id) ?>">
+                            <input type="hidden" name="assigned_groups[]"
+                                   value="<?= htmlReady($group->id) ?>">
 
-        <section class="studip-selection-selectable">
-            <p><strong><?= _('Gruppen der Veranstaltung') ?></strong></p>
-            <ul>
-                <? foreach ($groups as $group): ?>
-                    <? if (!$assigned_groups->find($group->id)): ?>
-                        <li data-selection-id="<?= htmlReady($group->id) ?>" >
                             <span class="studip-selection-label">
                                 <?= htmlReady($group->name) ?>
                             </span>
                         </li>
-                    <? endif ?>
-                <? endforeach ?>
-                <li class="empty-placeholder">
-                    <?= _('Alle Gruppen wurden dem Termin zugewiesen') ?>
-                </li>
-            </ul>
-        </section>
+                    <? endforeach ?>
+                    <li class="empty-placeholder">
+                        <?= _('Keine spezielle Gruppe zugewiesen') ?>
+                    </li>
+                </ul>
+            </section>
+
+            <section class="studip-selection-selectable">
+                <p><strong><?= _('Gruppen der Veranstaltung') ?></strong></p>
+                <ul>
+                    <? foreach ($groups as $group): ?>
+                        <? if (!$assigned_groups->find($group->id)): ?>
+                            <li data-selection-id="<?= htmlReady($group->id) ?>" >
+                                <span class="studip-selection-label">
+                                    <?= htmlReady($group->name) ?>
+                                </span>
+                            </li>
+                        <? endif ?>
+                    <? endforeach ?>
+                    <li class="empty-placeholder">
+                        <?= _('Alle Gruppen wurden dem Termin zugewiesen') ?>
+                    </li>
+                </ul>
+            </section>
+        </div>
     </fieldset>
 <? endif ?>
 
diff --git a/resources/assets/stylesheets/scss/studip-selection.scss b/resources/assets/stylesheets/scss/studip-selection.scss
index db539f1f797..17861454511 100644
--- a/resources/assets/stylesheets/scss/studip-selection.scss
+++ b/resources/assets/stylesheets/scss/studip-selection.scss
@@ -3,14 +3,6 @@
     flex-direction: row;
     flex-wrap: wrap;
 
-    > * {
-        flex: 1 0 100%;
-    }
-
-    > legend {
-        margin-bottom: 0 !important;
-    }
-
     // General list item styles and placeholders
     ul, li {
         list-style: none;
-- 
GitLab