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