98 lines
3.0 KiB
PHP
98 lines
3.0 KiB
PHP
@extends('layouts/sidebar')
|
|
|
|
@section('title')
|
|
@if($title)
|
|
{{$title}} - Nieuws
|
|
@endif
|
|
@endsection
|
|
|
|
@section('page_class')
|
|
news_post post_container
|
|
@endsection
|
|
|
|
@if(!empty($listingJsonld))
|
|
@push('head')
|
|
@include('partial/listing_jsonld', ['title' => $title, 'news' => $news, 'canonical' => $canonical, 'pageNumber' => $pageNumber])
|
|
@endpush
|
|
@endif
|
|
@section('page_container_class')
|
|
{{-- 'news': same list rows as on /nieuws --}}
|
|
grey_background news
|
|
@endsection
|
|
@section('site_container_class')
|
|
grey_background
|
|
@endsection
|
|
|
|
@section('breadcrumb')
|
|
@if($title)
|
|
<ul class="bread_crumb" style="margin-top: -10px; margin-bottom: 4px; ">
|
|
<li><a title="Home" href="/">Home</a></li>
|
|
<li class="separator"><i class="fa-solid fa-chevron-right"></i></li>
|
|
<li><a title="Nieuws" href="{{route('nieuws')}}">Nieuws</a></li>
|
|
<li class="separator"><i class="fa-solid fa-chevron-right"></i></li>
|
|
<li>{{$title}}</li>
|
|
</ul>
|
|
@endif
|
|
@endsection
|
|
|
|
@section('content')
|
|
<div class="post_body">
|
|
{{-- All articles as compact rows, the same as on /nieuws and the homepage lists --}}
|
|
<div id="items">
|
|
@include('partial/newslist_small', ['id' => 'items-more-news', 'news' => $news])
|
|
</div>
|
|
|
|
@if(count($news) >= 15)
|
|
<div>
|
|
{{-- The JavaScript loads more items in place; the link to the next page is for search engines --}}
|
|
<a class="btn auto_width" id="meer-nieuws" href="?pagina={{ ($pageNumber ?? 1) + 1 }}"
|
|
data-loadmorenews='{"container":["#items-more-news"]}'>
|
|
<span class="fas fa-spinner fa-spin" id="loading"></span>
|
|
LAAD MEER NIEUWSBERICHTEN
|
|
</a>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
var nextPage = 2;
|
|
var isLoading = 0;
|
|
var $isLoading = $('#loading').hide();
|
|
|
|
$('#meer-nieuws').click(function (e) {
|
|
e.preventDefault();
|
|
if (!isLoading) {
|
|
// Set flag and update UI
|
|
isLoading = 1;
|
|
$isLoading.show();
|
|
var $button = $(this).attr("disabled", "disabled");
|
|
|
|
// Fire request for the next page
|
|
$.ajax({url: document.location.pathname + '?pagina=' + nextPage})
|
|
.always(function () {
|
|
// Whether success or failure, update the UI again
|
|
isLoading = 0;
|
|
$isLoading.hide();
|
|
$button.removeAttr("disabled");
|
|
})
|
|
.done(function (data) {
|
|
if (!data) {
|
|
// When no data was returned, disable the button permanently
|
|
page = -1;
|
|
$('#items').append("<hr /><p>Er zijn geen nieuwsberichten (meer).</p>");
|
|
$button.remove();
|
|
return;
|
|
}
|
|
|
|
$('#items').append(data);
|
|
++nextPage;
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|
|
|