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