xref: /webtrees/resources/views/modules/recent_changes/changes-list.phtml (revision 81b514b4672980e5db010e9d89b55eaf131e798f)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\View;
7use Illuminate\Support\Collection;
8
9/**
10 * @var int                    $id
11 * @var int                    $limit_low
12 * @var int                    $limit_high
13 * @var Collection<int,object> $rows
14 * @var bool                   $show_date
15 * @var bool                   $show_user
16 */
17
18?>
19
20<?php foreach ($rows as $n => $row) : ?>
21    <?php if ($n === $limit_low && $rows->count() > $limit_high) : ?>
22        <div>
23            <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>">
24                <?= view('icons/add') ?>
25                <?= /* I18N: button label */ I18N::translate('show more') ?>
26            </button>
27        </div>
28
29        <?php View::push('javascript') ?>
30        <script>
31            document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) {
32                document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) {
33                    el.classList.remove("d-none");
34                });
35                ev.target.parentNode.removeChild(ev.target);
36            });
37        </script>
38        <?php View::endpush() ?>
39    <?php endif ?>
40
41    <div class="<?= $n >= $limit_low && $rows->count() > $limit_high ? 'd-none' : '' ?>">
42        <a href="<?= e($row->record->url()) ?>">
43            <?= $row->record->fullName() ?>
44        </a>
45
46        <div class="indent mb-1">
47            <?php if ($show_user && $show_date) : ?>
48                <?= /* I18N: [a record was] Changed on <date/time> by <user> */I18N::translate('Changed on %1$s by %2$s', view('components/datetime', ['timestamp' => $row->time]), e($row->record->lastChangeUser())) ?>
49            <?php elseif ($show_date) : ?>
50                <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed on %1$s', view('components/datetime', ['timestamp' => $row->time])) ?>
51            <?php elseif ($show_user) : ?>
52                <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed by %1$s', e($row->user->userName())) ?>
53            <?php endif ?>
54        </div>
55    </div>
56<?php endforeach ?>
57