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