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