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