xref: /webtrees/resources/views/modules/recent_changes/changes-list.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5d70512abSGreg Roachuse Fisharebest\Webtrees\I18N;
6e24053e5SGreg Roachuse Fisharebest\Webtrees\View;
7bd77bf38SGreg Roachuse Illuminate\Support\Collection;
8bd77bf38SGreg Roach
9bd77bf38SGreg Roach/**
107c2c99faSGreg Roach * @var int                    $id
1101221f27SGreg Roach * @var int                    $limit_low
1201221f27SGreg Roach * @var int                    $limit_high
1336779af1SGreg Roach * @var Collection<int,object> $rows
14501bc70dSGreg Roach * @var bool                   $show_date
15e24053e5SGreg Roach * @var bool                   $show_user
16bd77bf38SGreg Roach */
17d70512abSGreg Roach
18d70512abSGreg Roach?>
19dd6b2bfcSGreg Roach
20e24053e5SGreg Roach<?php foreach ($rows as $n => $row) : ?>
2101221f27SGreg Roach    <?php if ($n === $limit_low && $rows->count() > $limit_high) : ?>
22e24053e5SGreg Roach        <div>
23e24053e5SGreg Roach            <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>">
24e24053e5SGreg Roach                <?= view('icons/add') ?>
25e24053e5SGreg Roach                <?= /* I18N: button label */ I18N::translate('show more') ?>
26e24053e5SGreg Roach            </button>
27e24053e5SGreg Roach        </div>
28cb867caaSGreg Roach
29cb867caaSGreg Roach        <?php View::push('javascript') ?>
30cb867caaSGreg Roach        <script>
31cb867caaSGreg Roach            document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) {
32cb867caaSGreg Roach                document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) {
33cb867caaSGreg Roach                    el.classList.remove("d-none");
34cb867caaSGreg Roach                });
35cb867caaSGreg Roach                ev.target.parentNode.removeChild(ev.target);
36cb867caaSGreg Roach            });
37cb867caaSGreg Roach        </script>
38b4c5c807SGreg Roach        <?php View::endpush() ?>
39e24053e5SGreg Roach    <?php endif ?>
40e24053e5SGreg Roach
4101221f27SGreg Roach    <div class="<?= $n >= $limit_low && $rows->count() > $limit_high ? 'd-none' : '' ?>">
42e24053e5SGreg Roach        <a href="<?= e($row->record->url()) ?>">
43bd77bf38SGreg Roach            <?= $row->record->fullName() ?>
44dd6b2bfcSGreg Roach        </a>
45bd77bf38SGreg Roach
46dd6b2bfcSGreg Roach        <div class="indent mb-1">
47501bc70dSGreg Roach            <?php if ($show_user && $show_date) : ?>
4858124fe5SDavid Drury                <?= /* 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())) ?>
49501bc70dSGreg Roach            <?php elseif ($show_date) : ?>
5058124fe5SDavid Drury                <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed on %1$s', view('components/datetime', ['timestamp' => $row->time])) ?>
51501bc70dSGreg Roach            <?php elseif ($show_user) : ?>
52e10e1dc9SGreg Roach                <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed by %1$s', e($row->user->userName())) ?>
53dd6b2bfcSGreg Roach            <?php endif ?>
54dd6b2bfcSGreg Roach        </div>
55e24053e5SGreg Roach    </div>
56dd6b2bfcSGreg Roach<?php endforeach ?>
57