Move checkin list to partial

This commit is contained in:
Ben Goldsworthy 2022-11-28 13:46:12 -06:00
parent 91d1a18471
commit 8dc74febcf
2 changed files with 18 additions and 16 deletions

View file

@ -0,0 +1,16 @@
@foreach($checkinsList as $checkin)
<li>
<details class="checkin" id="{{ $checkin->id }}" ontoggle="toggleCheckin(this.open, this.id)">
<summary class="checkin__summary">
<h2 class="checkin__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h2>
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
</summary>
@if($checkin->note)
{!! $checkin->note !!}
@endif
@if($checkin->image_url)
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
@endif
</details>
</li>
@endforeach

View file

@ -38,22 +38,8 @@
@php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp @php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp
@endif @endif
@foreach($checkinsList as $checkin) @include('partials.checkin-list')
<li>
<details class="checkin" id="{{ $checkin->id }}" ontoggle="toggleCheckin(this.open, this.id)">
<summary class="checkin__summary">
<h2 class="checkin__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h2>
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
</summary>
@if($checkin->note)
{!! $checkin->note !!}
@endif
@if($checkin->image_url)
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
@endif
</details>
</li>
@endforeach
</ol> </ol>
@if (!$showAllCheckins) @if (!$showAllCheckins)
<p><a id="allCheckinsLink" href="?show=all">Show all checkins</a></p> <p><a id="allCheckinsLink" href="?show=all">Show all checkins</a></p>