148f08416SGreg Roach<?php 248f08416SGreg Roach 348f08416SGreg Roachuse Fisharebest\Webtrees\Fact; 4e24053e5SGreg Roachuse Fisharebest\Webtrees\I18N; 548f08416SGreg Roachuse Fisharebest\Webtrees\Individual; 6d97083feSGreg Roachuse Fisharebest\Webtrees\Registry; 7e24053e5SGreg Roachuse Fisharebest\Webtrees\View; 8cd51dbdfSGreg Roachuse Illuminate\Support\Collection; 948f08416SGreg Roach 10cd51dbdfSGreg Roach/** 1136779af1SGreg Roach * @var Collection<int,Fact> $facts 127c2c99faSGreg Roach * @var int $id 1301221f27SGreg Roach * @var int $limit_low 1401221f27SGreg Roach * @var int $limit_high 15cd51dbdfSGreg Roach */ 1648f08416SGreg Roach 1748f08416SGreg Roach?> 1848f08416SGreg Roach 19e24053e5SGreg Roach<?php foreach ($facts as $n => $fact) : ?> 2001221f27SGreg Roach <?php if ($n === $limit_low && $facts->count() > $limit_high) : ?> 21e24053e5SGreg Roach <div> 22e24053e5SGreg Roach <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>"> 23e24053e5SGreg Roach <?= view('icons/add') ?> 24e24053e5SGreg Roach <?= /* I18N: button label */ I18N::translate('show more') ?> 25e24053e5SGreg Roach </button> 26e24053e5SGreg Roach </div> 27cb867caaSGreg Roach 28cb867caaSGreg Roach <?php View::push('javascript') ?> 29cb867caaSGreg Roach <script> 30cb867caaSGreg Roach document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) { 31cb867caaSGreg Roach document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) { 32cb867caaSGreg Roach el.classList.remove("d-none"); 33cb867caaSGreg Roach }); 34cb867caaSGreg Roach ev.target.parentNode.removeChild(ev.target); 35cb867caaSGreg Roach }); 36cb867caaSGreg Roach </script> 37*b4c5c807SGreg Roach <?php View::endpush() ?> 38e24053e5SGreg Roach <?php endif ?> 39e24053e5SGreg Roach 4001221f27SGreg Roach <div class="<?= $n >= $limit_low && $facts->count() > $limit_high ? 'd-none' : '' ?>"> 4148f08416SGreg Roach <?php $record = $fact->record(); ?> 427a821518SGreg Roach <a href="<?= e($record->url()) ?>" class="list_item"> 4348f08416SGreg Roach <?= $record->fullName() ?> 4448f08416SGreg Roach </a> 4548f08416SGreg Roach <?php if ($record instanceof Individual) : ?> 4608362db4SGreg Roach <?= view('icons/sex', ['sex' => $record->sex()]) ?> 4748f08416SGreg Roach <?php endif ?> 4848f08416SGreg Roach <div class="indent"> 4966ecd017SGreg Roach <?= $fact->label() . ' — ' . $fact->date()->display($record->tree(), null, true) ?> 50d97083feSGreg Roach (<?= Registry::timestampFactory()->now()->subtractYears($fact->anniv)->diffForHumans() ?>) 5148f08416SGreg Roach <?php if ($fact->place()->gedcomName() !== '') : ?> 5248f08416SGreg Roach — <a href="<?= e($fact->place()->url()) ?>" title="<?= strip_tags($fact->place()->fullName()) ?>"> 5348f08416SGreg Roach <?= $fact->place()->shortName() ?> 5448f08416SGreg Roach </a> 5548f08416SGreg Roach <?php endif ?> 5648f08416SGreg Roach </div> 57e24053e5SGreg Roach </div> 5848f08416SGreg Roach<?php endforeach ?> 59