Where-in-the-World-is-Ben/resources/views/partials/checkins-list.blade.php

47 lines
2.4 KiB
PHP
Raw Normal View History

2022-11-28 19:46:12 +00:00
@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)
@php
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
if (preg_match("/\.webm/", $filepath[1])) {
2023-01-14 21:02:31 +00:00
if (file_exists(public_path() . "/videos/" . $filepath[1])) {
$embed = '<video class="popup__video" controls>';
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
$embed .= '<p>Your browser doesn\'t support HTML video. Here is a <a href="' . url("/videos/" . $filepath[1]) . '">link to the video</a> instead.</p>';
$embed .= '</video>';
} else {
$embed = '<p>[This video has not yet been uploaded, try again later.]</p>';
}
} elseif (preg_match("/\.ogg/", $filepath[1])) {
2023-01-14 21:02:31 +00:00
if (file_exists(public_path() . "/audio/" . $filepath[1])) {
$embed = '<audio class="popup__audio" controls>';
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
$embed .= '<p>Download <a href="' . url("/audio/" . $filepath[1]) . '">OGG</a> audio.</p>';
$embed .= '</audio>';
} else {
$embed = '<p>[This audio recording has not yet been uploaded, try again later.]</p>';
}
}
$checkin->note = preg_replace("/\[\[[^\]]+\]\]/", $embed, $checkin->note);
}
@endphp
@if($checkin->id === 3930)
@include('partials.abolition-checkin')
2022-11-28 20:26:16 +00:00
@else
{!! $checkin->note !!}
2022-11-28 20:26:16 +00:00
@endif
2022-11-28 19:46:12 +00:00
@endif
2022-11-28 19:46:12 +00:00
@if($checkin->image_url)
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
@endif
</details>
</li>
@endforeach