xref: /webtrees/resources/views/modules/recent_changes/changes-list.phtml (revision afa67798854828b1edc33dd077960ec2b18e6140)
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 ($show_user && $show_date) : ?>
46              <?= /* 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())) ?>
47          <?php elseif ($show_date) : ?>
48              <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed on %1$s', view('components/datetime', ['timestamp' => $row->time])) ?>
49          <?php elseif ($show_user) : ?>
50              <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed by %1$s', e($row->user->userName())) ?>
51          <?php endif ?>
52        </div>
53    </div>
54<?php endforeach ?>
55