xref: /webtrees/resources/views/modules/yahrzeit/list.phtml (revision 64d12f7b9a9462c8fcd06eb53b52f5b2d2a444f3)
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
24        <?php View::push('javascript') ?>
25        <script>
26            document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) {
27                document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) {
28                    el.classList.remove("d-none");
29                });
30                ev.target.parentNode.removeChild(ev.target);
31            });
32        </script>
33        <?php View::endPush() ?>
34    <?php endif ?>
35
36    <div class="<?= $n >= $limit_low && $yahrzeits->count() > $limit_high ? 'd-none' : '' ?>">
37        <a href="<?= e($yahrzeit->individual->url()) ?>" class="list_item name2">
38            <?= $yahrzeit->individual->fullName() ?>
39        </a>
40        <small><?= view('icons/sex', ['sex' => $yahrzeit->individual->sex()]) ?></small>
41        <div class="indent">
42            <?= $yahrzeit->fact->date()->display(true, null, false) ?>,
43            <?= $yahrzeit->yahrzeit_date->display(true, null, false) ?>,
44            <?= I18N::translate('%s year anniversary', $yahrzeit->fact->anniv) ?>
45        </div>
46    </div>
47<?php endforeach ?>
48