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