1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\Fact; 6use Fisharebest\Webtrees\I18N; 7use Fisharebest\Webtrees\Individual; 8use Fisharebest\Webtrees\Registry; 9use Fisharebest\Webtrees\View; 10use Illuminate\Support\Collection; 11 12/** 13 * @var Collection<int,Fact> $facts 14 * @var int $id 15 * @var int $limit_low 16 * @var int $limit_high 17 */ 18 19?> 20 21<?php foreach ($facts as $n => $fact) : ?> 22 <?php if ($n === $limit_low && $facts->count() > $limit_high) : ?> 23 <div> 24 <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>"> 25 <?= view('icons/add') ?> 26 <?= /* I18N: button label */ I18N::translate('show more') ?> 27 </button> 28 </div> 29 30 <?php View::push('javascript') ?> 31 <script> 32 document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) { 33 document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) { 34 el.classList.remove("d-none"); 35 }); 36 ev.target.parentNode.removeChild(ev.target); 37 }); 38 </script> 39 <?php View::endpush() ?> 40 <?php endif ?> 41 42 <div class="<?= $n >= $limit_low && $facts->count() > $limit_high ? 'd-none' : '' ?>"> 43 <?php $record = $fact->record(); ?> 44 <a href="<?= e($record->url()) ?>" class="list_item"> 45 <?= $record->fullName() ?> 46 </a> 47 <?php if ($record instanceof Individual) : ?> 48 <?= view('icons/sex', ['sex' => $record->sex()]) ?> 49 <?php endif ?> 50 <div class="indent"> 51 <?= $fact->label() . ' — ' . $fact->date()->display($record->tree(), null, true) ?> 52 (<?= Registry::timestampFactory()->now()->subtractYears($fact->anniv)->diffForHumans() ?>) 53 <?php if ($fact->place()->gedcomName() !== '') : ?> 54 — <a href="<?= e($fact->place()->url()) ?>" title="<?= strip_tags($fact->place()->fullName()) ?>"> 55 <?= $fact->place()->shortName() ?> 56 </a> 57 <?php endif ?> 58 </div> 59 </div> 60<?php endforeach ?> 61