Add show-all-checkins route
This commit is contained in:
parent
6563a4b5e2
commit
f269b2cd8c
2 changed files with 30 additions and 7 deletions
|
@ -20,6 +20,9 @@
|
|||
<h1 class="page-title">@if ($trip->is_active) Where in the World is Ben? @else {{ $trip->name }} @endif</h1>
|
||||
<nav class="other-links">
|
||||
<ul>
|
||||
@if (!$trip->is_active)
|
||||
<li><p><a href="/">Current trip</a></p></li>
|
||||
@endif
|
||||
<li><p><a href="/past-trips">Past trips</a></p></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -41,7 +44,13 @@
|
|||
</section>
|
||||
<section id="checkinList">
|
||||
<ol start="{{ count($trip->checkins) }}" reversed>
|
||||
@foreach(array_slice(array_reverse($trip->checkins), 0, 15) as $checkin)
|
||||
@if($showAllCheckins)
|
||||
@php $checkinsList = array_reverse($trip->checkins) @endphp
|
||||
@else
|
||||
@php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp
|
||||
@endif
|
||||
|
||||
@foreach($checkinsList as $checkin)
|
||||
<li>
|
||||
<details class="checkin" id="{{ $checkin->id }}" ontoggle="toggleCheckin(this.open, this.id)">
|
||||
<summary class="checkin__summary">
|
||||
|
@ -56,6 +65,9 @@
|
|||
</li>
|
||||
@endforeach
|
||||
</ol>
|
||||
@if ($trip->is_active)
|
||||
<p><a id="allCheckinsLink" href="#">Show all checkins</a></p>
|
||||
@endif
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
@ -100,11 +112,17 @@
|
|||
* (to help provide context).
|
||||
*/
|
||||
map.fitBounds([
|
||||
@foreach(array_slice(array_reverse($trip->locations), 0, 25) as $location)
|
||||
@if ($trip->is_active)
|
||||
@foreach(array_slice(array_reverse($trip->locations), 0, 25) as $location)
|
||||
[{{ $location->latitude }}, {{$location->longitude }}],
|
||||
@endforeach
|
||||
@endforeach
|
||||
@else
|
||||
@foreach($trip->locations as $location)
|
||||
[{{ $location->latitude }}, {{$location->longitude }}],
|
||||
@endforeach
|
||||
@endif
|
||||
]);
|
||||
map.zoomOut(2);
|
||||
@if ($trip->is_active) map.zoomOut(2.5); @endif
|
||||
|
||||
/*
|
||||
* Add the current location marker.
|
||||
|
@ -123,6 +141,11 @@
|
|||
).addTo(map).setZIndexOffset(1000);
|
||||
currLocation.bindPopup('<p>Current location</p>').openPopup();
|
||||
|
||||
/*
|
||||
* Add all checkins link href.
|
||||
*/
|
||||
document.getElementById("allCheckinsLink").href = window.location.pathname + '/all';
|
||||
|
||||
/*
|
||||
* Changes the currently-selected popup.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue