diff --git a/app/controllers/course/statusgroups.php b/app/controllers/course/statusgroups.php index 1658a37b892e863a98ed780502403342dbc5121f..df8c86e7487d0dd006734b1ec66a478563e9a38f 100644 --- a/app/controllers/course/statusgroups.php +++ b/app/controllers/course/statusgroups.php @@ -580,9 +580,11 @@ class Course_StatusgroupsController extends AuthenticatedController if ($selfassign !== 0) { $selfassign += Request::int('exclusive', 0); // Selfassign is not set but exclusive selfassign or some timeframe -> show warning message - } else if (Request::int('exclusive', 0) !== 0 - || Request::get('selfassign_start', null) !== null - || Request::get('selfassign_end', null) !== null) { + } else if ( + Request::bool('exclusive') + || Request::get('selfassign_start') + || Request::get('selfassign_end') + ) { PageLayout::postWarning(_('Einstellungen zum Eintrag in eine Gruppe oder zum Eintragszeitraum können ' . 'nur gespeichert werden, wenn der Selbsteintrag aktiviert ist.')); } diff --git a/app/views/course/statusgroups/create_groups.php b/app/views/course/statusgroups/create_groups.php index c011b79253de7b6d63410dd3ee35d4864e779828..46165009ccbef5927cb0303dce1ff5a3556958eb 100644 --- a/app/views/course/statusgroups/create_groups.php +++ b/app/views/course/statusgroups/create_groups.php @@ -106,24 +106,25 @@ </section> <section> <label> - <input type="checkbox" name="selfassign" value="1"> + <input type="checkbox" name="selfassign" value="1" + data-shows=".self-assign-option"> <?= _('Selbsteintrag') ?> </label> </section> - <section> + <section class="self-assign-option"> <label> <input type="checkbox" name="exclusive" value="1"> <?= _('Selbsteintrag in nur eine Gruppe') ?> </label> </section> - <section class="col-3"> + <section class="col-3 self-assign-option"> <label class="col-3"> <?= _('Selbsteintrag erlaubt ab') ?> <input type="text" data-datetime-picker id="selfassign_start" size="20" name="selfassign_start" value="<?= date('d.m.Y H:i') ?>"> </label> </section> - <section class="col-3"> + <section class="col-3 self-assign-option"> <label class="col-3"> <?= _('Selbsteintrag erlaubt bis') ?> <input type="text" data-datetime-picker='{">":"#selfassign_start"}' size="20" diff --git a/app/views/course/statusgroups/edit.php b/app/views/course/statusgroups/edit.php index 1e71d3d9fc6ee746a7cdbd3eda8297db3e5a86f2..f09e0436b33cb3f797f16788599686e27bef2f07 100644 --- a/app/views/course/statusgroups/edit.php +++ b/app/views/course/statusgroups/edit.php @@ -39,22 +39,27 @@ </label> <label> - <input type="checkbox" name="selfassign" value="1"<?= $group->selfassign ? ' checked' : '' ?>> + <input type="checkbox" + name="selfassign" + value="1" + data-shows=".self-assign-option" + <?= $group->selfassign ? ' checked' : '' ?> + > <?= _('Selbsteintrag erlaubt') ?> </label> - <label> + <label class="self-assign-option"> <input type="checkbox" name="exclusive" value="1"<?= $group->selfassign == 2 ? ' checked' : '' ?>> <?= _('Exklusiver Selbsteintrag (in nur eine Gruppe)') ?> </label> - <label class="col-3"> + <label class="col-3 self-assign-option"> <?= _('Selbsteintrag erlaubt ab') ?> <input class="size-s" type="text" size="20" name="selfassign_start" id="selfassign_start" value="<?= $group->selfassign_start ? date('d.m.Y H:i', $group->selfassign_start) : '' ?>" data-datetime-picker> </label> - <label class="col-3"> + <label class="col-3 self-assign-option"> <?= _('Selbsteintrag erlaubt bis') ?> <input class="size-s" type="text" size="20" name="selfassign_end" value="<?= $group->selfassign_end ? date('d.m.Y H:i', $group->selfassign_end) : '' ?>" data-datetime-picker='{">":"#selfassign_start"}'> diff --git a/resources/assets/javascripts/lib/statusgroups.js b/resources/assets/javascripts/lib/statusgroups.js index 917396e33ded180ce26ef05bc76c73b1787e6cd2..6c1c5beeafbd9e420d00a2978caf3cc4cc738608 100644 --- a/resources/assets/javascripts/lib/statusgroups.js +++ b/resources/assets/javascripts/lib/statusgroups.js @@ -38,31 +38,6 @@ const Statusgroups = { }, initInputs: function() { - //$('input[name="selfassign_start"]').datetimepicker(); - if (!$('input[name="selfassign"]').attr('checked')) { - $('input[name="exclusive"]') - .closest($('section')) - .hide(); - $('input[name="selfassign_start"]') - .closest($('section')) - .hide(); - $('input[name="selfassign_end"]') - .closest($('section')) - .hide(); - } - //$('input[name="selfassign_end"]').datetimepicker(); - $('input[name="selfassign"]').on('click', function() { - $('input[name="exclusive"]') - .closest($('section')) - .toggle(); - $('input[name="selfassign_start"]') - .closest($('section')) - .toggle(); - $('input[name="selfassign_end"]') - .closest($('section')) - .toggle(); - }); - $('input[name="numbering_type"]').on('click', function() { var type = $('input[name="numbering_type"]:checked').val(), disabled = parseInt(type, 10) === 2;