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