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