xref: /webtrees/resources/views/modules/yahrzeit/list.phtml (revision bb1ec7dcf21066b641b778b9231f2ee56ad8cc1d)
1<?php
2
3use Fisharebest\Webtrees\I18N;
4use Fisharebest\Webtrees\View;
5use Illuminate\Support\Collection;
6
7/**
8 * @var int        $limit_low
9 * @var int        $limit_high
10 * @var Collection $yahrzeits
11 */
12
13?>
14
15<?php foreach ($yahrzeits as $n => $yahrzeit) : ?>
16    <?php if ($n === $limit_low && $yahrzeits->count() > $limit_high) : ?>
17        <div>
18            <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>">
19                <?= view('icons/add') ?>
20                <?= /* I18N: button label */ I18N::translate('show more') ?>
21            </button>
22        </div>
23    <?php endif ?>
24
25    <div class="<?= $n >= $limit_low && $yahrzeits->count() > $limit_high ? 'd-none' : '' ?>">
26        <a href="<?= e($yahrzeit->individual->url()) ?>" class="list_item name2">
27            <?= $yahrzeit->individual->fullName() ?>
28        </a>
29        <small><?= view('icons/sex', ['sex' => $yahrzeit->individual->sex()]) ?></small>
30        <div class="indent">
31            <?= $yahrzeit->fact->date()->display(true, null, false) ?>,
32            <?= $yahrzeit->yahrzeit_date->display(true, null, false) ?>,
33            <?= I18N::translate('%s year anniversary', $yahrzeit->fact->anniv) ?>
34        </div>
35    </div>
36<?php endforeach ?>
37
38<?php View::push('javascript') ?>
39<script>
40    document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) {
41        document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) {
42            el.classList.remove("d-none");
43        });
44        ev.target.parentNode.removeChild(ev.target);
45    });
46</script>
47<?php View::endPush() ?>
48