Add icons to checkins to show media
This commit is contained in:
parent
7a39bfd7d5
commit
79f57e6a11
2 changed files with 50 additions and 25 deletions
|
@ -351,3 +351,11 @@ body {
|
|||
margin-top: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.checkin-icon {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.checkin-icon--missing {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
@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
|
||||
$hasEmbed = null;
|
||||
$embedMissing = null;
|
||||
if (preg_match("/\[\[([^\]]+)\]\]/", $checkin->note, $filepath)) {
|
||||
if (preg_match("/\.webm/", $filepath[1])) {
|
||||
$hasEmbed = 'video';
|
||||
if (file_exists(public_path() . "/videos/" . $filepath[1])) {
|
||||
$embed = '<video class="popup__video" controls>';
|
||||
$embed .= '<source src="' . url("/videos/" . $filepath[1]) . '" type="video/webm">';
|
||||
|
@ -16,8 +13,10 @@
|
|||
$embed .= '</video>';
|
||||
} else {
|
||||
$embed = '<p>[The video \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]</p>';
|
||||
$embedMissing = true;
|
||||
}
|
||||
} elseif (preg_match("/\.ogg/", $filepath[1])) {
|
||||
$hasEmbed = 'audio';
|
||||
if (file_exists(public_path() . "/audio/" . $filepath[1])) {
|
||||
$embed = '<audio class="popup__audio" controls>';
|
||||
$embed .= '<source src="' . url("/audio/" . $filepath[1]) . '" type="audio/ogg">';
|
||||
|
@ -25,11 +24,29 @@
|
|||
$embed .= '</audio>';
|
||||
} else {
|
||||
$embed = '<p>[The recording \'' . $filepath[1] . '\' has not yet been uploaded, try again later.]</p>';
|
||||
$embedMissing = true;
|
||||
}
|
||||
}
|
||||
$checkin->note = preg_replace("/\[\[[^\]]+\]\]/", $embed, $checkin->note);
|
||||
}
|
||||
@endphp
|
||||
<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>" !!}
|
||||
@if($hasEmbed)
|
||||
@if($hasEmbed === 'video')
|
||||
<span class="checkin-icon @if($embedMissing) checkin-icon--missing @endif">📹</span>
|
||||
@endif
|
||||
@if($hasEmbed === 'audio')
|
||||
<span class="checkin-icon @if($embedMissing) checkin-icon--missing @endif">🔈</span>
|
||||
@endif
|
||||
|
||||
@endif
|
||||
</h2>
|
||||
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
|
||||
</summary>
|
||||
@if($checkin->note)
|
||||
|
||||
@if($checkin->id === 3930)
|
||||
@include('partials.abolition-checkin')
|
||||
|
|
Loading…
Reference in a new issue