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