Zoekfunctie, links gefixt

This commit is contained in:
2020-02-04 20:22:40 +01:00
parent a32f4b7476
commit d1210e1441
11 changed files with 354 additions and 382 deletions

View File

@@ -1,153 +1,259 @@
@extends('layouts/full')
@extends('layouts/master')
@section('title')
NH Gooi - Nieuws
@endsection
@section('title', 'Home')
@section('content')
@parent
<div class="row">
<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 wow bounceInUp">
{{-- Nieuws komt met 15 berichten per pagina. Deel op in (1 + 3) in de kop,
1 x 2-breed en de rest 3-breed. --}}
<div class="page_layout page_margin_top clearfix">
<div class="row">
<div class="column column_1_1">
<div class="blog_grid">
{{-- Desktop --}}
<div class="grid_view">
<div class="row">
<div class="column">
@if($item = current($news))
<div class="post large">
<a href="{{url($item->url)}}" title="{{$item->title}}">
@if($item->video)
<span class="icon video"></span>
@elseif($item->images && count($item->images) > 1)
<span class="icon gallery"></span>
@endif
<img src='{{$item->images && count($item->images) ? $imgBase . $item->images[0]->url : '/images/noimage.png'}}' alt='img'>
</a>
<div class="slider_content_box">
<ul class="post_details simple">
<li class="category">
<a title="Regio: {{$item->region->title}}" href="{{url('nieuws/regio/' . $item->region->slug)}}" class="over_image">{{$item->region->title}}</a>
</li>
</ul>
<h2><a href="{{url($item->url)}}" title="{{$item->title}}">{{$item->title}}</a></h2>
</div>
</div>
@endif
</div>
<div class="column">
@for($i = 0; ($i < 3) && ($item = next($news)); ++$i)
<div class="row">
<div class="post small">
<a href="{{url($item->url)}}" title="{{$item->title}}">
@if($item->video)
<span class="icon video"></span>
@elseif($item->images && count($item->images) > 1)
<span class="icon gallery"></span>
@endif
<img src='{{$item->images && count($item->images) ? $imgBase . $item->images[0]->url : '/images/noimage.png'}}' alt='img'>
</a>
<div class="slider_content_box">
<ul class="post_details simple">
<li class="category">
<a title="Regio: {{$item->region->title}}" href="{{url('nieuws/regio/' . $item->region->slug)}}" class="over_image">{{$item->region->title}}</a>
</li>
</ul>
<h5><a href="{{url($item->url)}}" title="{{$item->title}}">{{$item->title}}</a></h5>
</div>
</div>
</div>
@endfor
</div>
</div>
</div>
{{-- Mobile --}}
<div class="slider_view">
<div class="caroufredsel_wrapper caroufredsel_wrapper_slider">
<ul class="slider id-small_slider">
@foreach($news as $item)
@if($loop->index > 3) @break @endif
<li class="slide">
<a href="{{url($item->url)}}" title="{{$item->title}}">
@if($item->video)
<span class="icon video"></span>
@elseif($item->images && count($item->images) > 1)
<span class="icon gallery"></span>
@endif
<img src='{{$item->images && count($item->images) ? $imgBase . $item->images[0]->url : '/images/noimage.png'}}' alt='img'>
</a>
<div class="slider_content_box">
<ul class="post_details simple">
<li class="category">
<a title="Regio: {{$item->region->title}}" href="{{url('nieuws/regio/' . $item->region->slug)}}" class="over_image">{{$item->region->title}}</a>
</li>
</ul>
<h2 style="display:none;"><a href="{{url($item->url)}}" title="{{$item->title}}">{{Formatter::excerpt($item->title, 50)}}</a></h2>
<h5><a href="{{url($item->url)}}" title="sfd">{{$item->title}}</a></h5>
</div>
</li>
@endforeach
</ul>
</div>
<div id="small_slider" class='slider_posts_list_container small'>
</div>
</div>
</div>
</div>
</div>
{{-- Meer nieuws --}}
<div class="row page_margin_top">
<div class="column column_2_3">
<h4 class="box_header">Meer nieuws</h4>
@foreach(array_slice($news, 4, 2) as $item)
@if($loop->index % 2 == 0)
<div class="row">
@endif
<div class="column column_1_2">
<ul class="blog">
<li class="post">
<a href="{{url($item->url)}}" title="{{$item->title}}">
@if($item->video)
<span class="icon video"></span>
@elseif($item->images && count($item->images) > 1)
<span class="icon gallery"></span>
@endif
<img src='{{$item->images && count($item->images) ? $imgBase . $item->images[0]->url : '/images/noimage.png'}}' alt='img'>
</a>
<h2><a href="{{url($item->url)}}" title="{{$item->title}}">{{$item->title}}</a></h2>
<ul class="post_details">
<li class="category">
<a title="Regio: {{$item->region->title}}" href="{{url('nieuws/regio/' . $item->region->slug)}}">{{$item->region->title}}</a>
</li>
<li class="category">
<a title="Thema: {{$item->theme->title}}" href="{{url('nieuws/thema/' . $item->theme->slug)}}">{{$item->theme->title}}</a>
</li>
36 @if($item->edited && ($item->edited != $item->published))
<li class="date edited">
Bijgewerkt
@if($item->edited->format('d m') != $item->published->format('d m'))
op {{Formatter::relativeDate($item->edited)}}
@endif
om {{$item->edited->format('H:i')}} uur
</li>
@else
<li class="date">
{{Formatter::relativeDate($item->published)}} om {{$item->published->format('H:i')}} uur
</li>
@endif
</ul>
<p>{{Formatter::excerpt($item->content, 150)}}</p>
<a class="read_more" href="{{url($item->url)}}" title="Lees verder"><span class="arrow"></span><span>Lees verder...</span></a>
</li>
</ul>
</div>
@if($loop->index % 2 == 1)
</div>
@endif
@endforeach
@php($newsItem = current($news))
@php($podcast = current($podcasts))
@php($index = 0)
@while($newsItem !== false || $podcast !== false)
@if(++$index % 2 == 1)
@if($index > 2)
</div>
@endif
<div class="row">
@endif
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="left_content">
<?php // Show podcast(s) if we have any and either (a) we are out of news items but have an odd number of items, so we complete the row
// or (b) we have a news item but the podcast is the first podcast on the same date, in which case it has to come first for extra attention. ?>
@if($newsItem === false && ($index % 2) == 1)
</div><!--./left_content-->
</div><!--./col-->
@break
@endif
@if(($podcast !== false) && (($newsItem === false) || ($podcast->created >= $newsItem->published->setTime(0, 0, 0))))
@php($podcastsInBlock = [])
@php($firstPodcast = $podcast)
@while(($podcast !== false) && ($podcast->program == $firstPodcast->program) && ($podcast->created->format('d-m-Y') == $firstPodcast->created->format('d-m-Y')))
@php($podcastsInBlock[] = $podcast)
@php($podcast = next($podcasts))
@endwhile
<div id="items">
@include('partial/newslist_small', ['news' => array_slice($news, 6, count($news))])
</div>
<h2><span class="fa fa-headphones"></span> Audiofragment</h2>
<div class="details">
@if(count($podcastsInBlock) == 1)
<h3 class="news-title"><a href="{{url('radio/gemist/fragment/' . $firstPodcast->url)}}" title="{{$firstPodcast->title}}">{{$firstPodcast->title}}</a></h3>
<div class="post-date">{{Formatter::relativeDate($firstPodcast->created)}}</div>
{!! $firstPodcast->excerpt() !!}
<p>
<a href="{{url('radio/gemist/fragment/' . $firstPodcast->url)}}" title="{{$firstPodcast->title}}" class="btn btn-info">Luister fragment</a>
<a href="{{url('radio/gemist')}}" title="Luister eerder uitgezonden fragmenten terug" class="btn btn-default">Meer fragmenten</a>
</p>
@else
<h3 class="news-title">@if($firstPodcast->program) {{$firstPodcast->program->name}} @else Fragment gemist? @endif</h3>
<div class="post-date">{{Formatter::relativeDate($firstPodcast->created)}} uitgezonden</div>
@if(count($podcastsInBlock) < 3)
<div class="news-item news-item-small wow fadeInDown">
<div class="thumb">
<img class="entry-thumb" src="{{url('images/podcast.png')}}" alt="Fragment gemist" title="Luister fragmenten terug van {{$firstPodcast->program ? $firstPodcast->program->name : "onze eerdere uitzendingen" }}"/>
</div><!--/.thumb-->
</div><!--/.news-item-->
@endif
<ul>
@foreach($podcastsInBlock as $currentPodcast)
@if($loop->index > 10 && $loop->remaining > 2)
<li><p>... en <a href="{{url('radio/gemist/programma' . $firstPodcast->program->url)}}" title="Bekijk meer fragmenten uit {{$firstPodcast->program->name}}">nog {{$loop->remaining}} fragmenten</a>.</p></li>
@break
@endif
<li><span class="fa fa-angle-right"></span> <a href="{{url('radio/gemist/fragment/' . $currentPodcast->url)}}" title="{{$currentPodcast->title}}">{{$currentPodcast->titleWithoutProgram()}}</a></li>
@endforeach
</ul>
<div class="clearfix" style="height: 15px;"></div>
<p>
@if($firstPodcast->program) <a href="{{url('radio/programma' . $firstPodcast->program->url)}}" title="Meer informatie over {{$firstPodcast->program->name}}" class="btn btn-info">Over dit programma</a> @endif
<a href="{{url('radio/gemist' . ($firstPodcast->program ? '/programma' . $firstPodcast->program->url : ''))}}" title="Luister eerder uitgezonden fragmenten terug" class="btn btn-default">Meer fragmenten</a>
</p>
@endif
</div><!--./details-->
@if($newsItem === false) <?php // If we got here, we are out of news items: we only included (a) podcast(s) to complete the column. Close the open tags and bail out of the while loop ?>
</div><!--./left_content-->
</div><!--./col-->
@break
@endif
@elseif($newsItem !== false)
<h2>@if($newsItem->video) <span class="fa fa-video-camera"></span> Video @else <span class="fa fa-newspaper-o"></span> Nieuws @endif </h2>
@php($image = count($newsItem->images) ? $newsItem->images[0] : null)
@if($image || $newsItem->video)
<div class="news-item news-item-small wow fadeInDown">
<div class="thumb">
<a href="{{$newsItem->url}}" rel="bookmark" title="{{$newsItem->title}}">
<img class="entry-thumb" src="{{ url( $image ? $image->url : 'images/video.png' )}}" alt="{{$image ? $image->title : 'Video'}}" title="{{$image ? $image->title : 'Klik om de video te bekijken'}}"/>
</a>
</div><!--/.thumb-->
</div><!--/.news-item-->
@endif
<div class="details">
<h3 class="news-title"><a href="{{$newsItem->url}}" rel="bookmark" title="{{$newsItem->title}}">{{$newsItem->title}}</a></h3>
<div class="post-date">
@if($newsItem->edited)
<time class="entry-date edited" datetime="{{$newsItem->edited->format('c')}}"><strong>Laatste update: {{Formatter::relativeDate($newsItem->edited, /*capitalize:*/ false)}} om {{$newsItem->edited->format("H:i")}} uur</strong></time>.
@else
<time class="entry-date created" datetime="{{$newsItem->published->format('c')}}">{{Formatter::relativeDate($newsItem->published)}} om {{$newsItem->published->format("H:i")}} uur</time>.
@endif
</div><!--./post-date-->
<p class="news-excerpt {{$image ? "short" : "long" }}"><b>{{$newsItem->region->title}}</b> | {!!Formatter::excerpt($newsItem->content, $image ? 200 : 500)!!}</p>
<p><a href="{{$newsItem->url}}" class="btn btn-info">{!! $newsItem->video ? "<span class='fa fa-video-camera'></span> Bekijk video" : "Lees verder <span class='fa fa-arrow-right'></span>" !!}</a>
<a href="/nieuws" class="btn btn-default">Meer nieuws</a></p>
</div><!--/.details-->
@php($newsItem = next($news))
@endif
</div><!--./left_content-->
</div><!--./col-->
@endwhile
</div><!--./row-->
</div><!--./col-->
<div>
<button class="more page_margin_top" type="button" id='meer-nieuws'>
<span class="fa-2x fas fa-spinner fa-spin" id="loading"></span>
LAAD MEER NIEUWSBERICHTEN
</button>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<div class="left_content">
@include('banners')
<div class="wow bounceInRight">
@if(isset($comingUp) && count($comingUp) > 0)
<h2>Nu en straks op 6FM</h2>
<p>
<b>Nu tot {{$comingUp[0]['end']->format('H:i')}} uur:</b><br/>
<a href="{{ url('radio/programma' . $comingUp[0]['program']->url) }}">{{$comingUp[0]['program']->name}}</a>
</p>
<p><b>Straks op 6FM:</b></p>
<ul style="margin-top: -1em; margin-bottom: 1em; ">
@php($date = $comingUp[1]['start']->format('d-m-Y'))
@for($i = 1, $printed = 0; $i < count($comingUp) && $printed < 3; ++$i)
@if($comingUp[$i]['program']->priority > 2) @continue @endif
@if($date != ($newDate = $comingUp[$i]['start']->format('d-m-Y')))
@php($date = $newDate)
</ul>
<p><b>{{ Formatter::fullDate($comingUp[$i]['start'], 'W') }}:</b></p>
<ul style="margin-top: -1em; margin-bottom: 1em; ">
@endif
<li>{{ $comingUp[$i]['start']->format('H:i') }} uur: <a href="{{ url('radio/programma' . $comingUp[$i]['program']->url) }}">{{$comingUp[$i]['program']->name}}</a></li>
@php(++$printed)
@endfor
</ul>
<p><b>Meer programma's?</b><br/><a href="{{url( '/radio/programmering' )}}" class="btn btn-primary">Programmaschema</a></p>
@endif
<div id="popularnews"><span class="fa fa-spinner fa-2x"></span></div>
</div><!--./ringle_post_content-->
</div><!--./left_content-->
</div><!--./col-->
</div><!--./row-->
<div class="column column_1_3">
<script type="text/javascript">
$.ajax({
'url': '{{ url('nieuws/populair') }}',
'success': function(data, status, xhr) {
$("#popularnews").html(data);
}
});
</script>
<h4 class="box_header"><span class="fa fa-fire"></span> &nbsp; Meest gelezen</h4>
@include('widgets.populairnieuws')
@include('widgets.nustraks')
<h4 class="page_margin_top box_header"><span class="fa fa-history"></span> &nbsp; Fragment gemist</h4>
@include('widgets.laatstepodcasts')
<a class="more page_margin_top" href="{{url('radio/gemist')}}">Meer Fragment Gemist</a>
<h4 class="page_margin_top box_header"><span class="fa fa-calendar"></span> &nbsp; Regioagenda</h4>
@include('widgets.regioagenda')
<a class="more page_margin_top" href="{{url('agenda')}}">Regio-agenda</a>
@if(!$title)
<h4 class="page_margin_top box_header"><span class="fa fa-tag"></span> &nbsp; Recente berichten</h4>
<?php
$regions = [];
$themes = [];
foreach($news as $item) {
$regions[$item->region->slug] = $item->region->title;
$themes[$item->theme->slug] = $item->theme->title;
}
?>
<ul class="taxonomies clearfix page_margin_top">
@foreach($regions as $slug => $title)
<li><a href="{{url('nieuws/regio/' . $slug)}}" title="Meer nieuws uit regio {{$title}}"><span class="fa fa-map-marker"></span> Uit {{$title}}</a></li>
@endforeach
@foreach($themes as $slug => $title)
<li class="active"><a href="{{url('nieuws/thema/' . $slug)}}" title="Meer nieuws met thema {{$title}}"><span class="fa fa-tag"></span> Over {{$title}}</a></li>
@endforeach
</ul>
@endif
</div>
</div>
</div>
@endsection
@section('oud')
@if($title) <h2> <a href="{{url('nieuws')}}" title="Terug naar het nieuwsoverzicht" class="btn btn-primary"><i class="icon-arrow-small-left"></i></a> {{$title}} </h2> @endif
<section class="page-content col-lg-8 col-md-12">
<div id="items">
@include('partial/newslistitems', ['news' => $news])
</div>
<div id="loading" style="display: none">
<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
<b>Meer nieuwsberichten ophalen...</b>
</div>
</div>
</div>
</section>
@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;
$button.attr("disabled", "disabled").text("Geen nieuws meer.");
return;
}
$('#items').append(data);
++nextPage;
});
}
});
</script>
@endpush