feature-news-date-filter #12

Merged
JoritWebsight merged 11 commits from feature-news-date-filter into dev 2025-06-30 17:03:27 +02:00
3 changed files with 174 additions and 9 deletions
Showing only changes of commit 3e7490531d - Show all commits

View File

@@ -22,22 +22,24 @@ class NewsController extends Controller
switch ($apiResult->version) {
case 1:
if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
return view('newsitem', ['news' => $newsItem, 'metadata' => $newsItem->metadata]);
break;
if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
case 2:
case 2:
if(isset($apiResult->source->article)) {
$source = $apiResult->source->article;
$newsItem->published = self::TimestampToDateTime($source->created);
$newsItem->edited = self::TimestampToDateTime($source->updated);
$newsItem->author = $source->author;
$newsItem->images = null; // Images will be embedded
$newsItem->video = null; // Videos will be embedded
$newsItem->content = $source->blocks;
$newsItem->content = $source->blocks;
} elseif(isset($apiResult->source->blocks)) {
$newsItem->content = $apiResult->source->blocks;
}
return view('newsitem', array_merge($this->getSidebareData(), ['news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
return view('newsitem', array_merge($this->getSidebareData(), ['type' => $apiResult->type, 'news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
}
}

View File

@@ -87,8 +87,10 @@
@endif
@endif
@if(is_array($news->content))
@include('partial/nh_story', ['content' => $news->content])
@if($type == "nhnieuws")
@include('partial/nh_story', ['content' => $news->content])
@elseif($type == "artikel")
@include('partial/block_story', ['content' => $news->content])
@else
<div class="text">
<p>{!!$news->content!!}</p>

View File

@@ -0,0 +1,161 @@
@foreach($content as $block)
@if($block->type == "headerRichA")
@php($block->data->image->url = isset($block->data->image->crops)
? $block->data->image->crops->{'16:9'}->{'1600'}
: $block->data->image->crop)
<a href="{{$block->data->image->url}}" class="post_image page_margin_top prettyPhoto" rel="prettyPhoto"
title="{{$block->data->image->title}}">
<img src="{{$block->data->image->url}}" alt="{{$block->data->image->title}}">
</a>
<div class="sentence margin_top_10">
<span class="text">{{$block->data->image->title}}</span>
@if($block->data->image->author)
<span class="author">{{$block->data->image->author}}</span>
@endif
</div>
@elseif($block->type == "paragraph")
<div class="text">{!!$block->data->text!!}</div>
@elseif($block->type == "intro")
<h3 class="excerpt">{!!strip_tags($block->data->text)!!}</h3>
@elseif($block->type == "info")
@if(strpos($block->data->text, "Meer nieuws uit 't Gooi?") === false)
<div class="info" style="background-color: {{$block->data->color}};">{!!($block->data->text)!!}</div>
@endif
@elseif($block->type == "quote")
<blockquote>
{!!$block->data->text!!}
<div class="author">{{$block->data->caption}}</div>
</blockquote>
@elseif($block->type == "image")
<?php
if(isset($block->data->image->imageWide))
$image = $block->data->image->imageWide;
else if(isset($block->data->image->crop))
$image = $block->data->image->crop;
else if(isset($block->data->image->crops) && isset($block->data->image->crops->{'16:9'}))
foreach($block->data->image->crops->{'16:9'} as $image) break;
else if(isset($block->data->image->imageHigh))
$image = $block->data->image->imageHigh;
else $image = null;
?>
@if($image)
<a class="post_image page_margin_top prettyPhoto" rel="prettyPhoto" href="{{$image}}"
title="{{$block->data->image->title}} &copy; {{$block->data->image->author}}">
<img src="{{$image}}" class="attachment-small-slider-thumb size-small-slider-thumb wp-post-image"
alt="{{$block->data->image->title}}" title="" style="display: block;">
</a>
<div class="sentence">
<?php
$sentence = [];
if (isset($block->data->image->caption) && $block->data->image->caption) {
$sentence[] = '<span class="text">' . $block->data->image->caption . '</span>';
} elseif (isset($block->data->image->title) && $block->data->image->title) {
$sentence[] = '<span class="text">' . $block->data->image->title . '</span>';
}
if (isset($block->data->image->author) && $block->data->image->author) {
$sentence[] = '<span class="author">' . $block->data->image->author . '</span>';
}
$sentence = join('<span class="separator">|</span>', $sentence);
?>
{!!$sentence!!}
</div>
@endif
@elseif($block->type == "video" || $block->type == "headerVideo")
@include('widgets/mediaplayer')
<?php
$attr = '';
if (isset($block->data->video->images[0]->imageMedia) && $block->data->video->images[0]->imageMedia) {
$attr = ' poster="' . $block->data->video->images[0]->imageMedia . '"';
}
?>
<video controls{!!$attr!!}>
@foreach($block->data->video->streams as $stream)
<source src="{!!$stream->stream_url!!}" type="application/x-mpegurl" />
@endforeach
</video>
<div class="sentence">
<span class="author">{{$block->data->video->author}}</span>
</div>
@elseif($block->type == "carousel")
<div class="horizontal_carousel_container gallery">
<ul class="horizontal_carousel visible-5 autoplay-1 scroll-1 navigation-1 easing-easeInOutQuint duration-750">
@foreach($block->data->items as $image)
<?php
if(isset($image->image->imageWide))
$img = $image->image->imageWide;
else if(isset($block->data->image->crop))
$image = $block->data->image->crop;
else if(isset($image->image->crops) && isset($image->image->crops->{'16:9'}))
foreach($image->image->crops->{'16:9'} as $img) break;
else if(isset($image->image->imageHigh))
$img = $image->image->imageHigh;
else $img = null;
?>
@if($img)
<li>
<a href="{{$img}}" class="post_image prettyPhoto" rel="prettyPhoto[gallery]"
title="{{$image->image->title}} &copy; {{$image->image->author}}">
<img src="{{$img}}" alt="{{$image->image->title}}" title="{{$image->image->title}}">
</a>
</li>
@endif
@endforeach
</ul>
</div>
@elseif($block->type == "oembed")
<div class="oembed" data-url="{{$block->data->url}}">{!!$block->data->html!!}</div>
@elseif($block->type == "podcast" && $block->data->id == $news->podcast?->id)
@include('widgets/podcastplayer', ['podcast' => $news->podcast])
<? $news->podcast = null; // Avoid adding the player again ?>
@elseif($block->type == 'article' && count($block->data->articles) && $block->data->articles[0]->published)
<div class="block">
<h4 class="box_header"><span>{{ $block->data->title }}</span></h4>
<div class="box full-width">
<ul id="items-more-news" class="blog">
@foreach($block->data->articles as $article)
<? if(!isset($article->published)) continue;
$article->published = new \DateTime($article->published); ?>
<li class="post">
<div class="row">
@if($article->image)
<div class="col-4">
<a href="{{ route('nieuws.detail', ['id' => $article->id, 'title' => $article->slug]) }}"
title="{{ $article->title }}">
<img src="{{ $article->image[0] == '/' ? '' : '/' }}{{ $article->image }}" alt="{{ $article->image_title }}">
</a>
</div>
@endif
<div class="col-8">
<h2 class="post_title"><a class="clipText clipText-3"
href="{{ route('nieuws.detail', ['id' => $article->id, 'title' => $article->slug]) }}"
title="{!! $article->title !!}">{!! $article->title !!}</a></h2>
<span class="post_date" title="Vandaag om 09:30">
<i class="fa-regular fa-clock"></i>
{{Formatter::relativeDate($article->published)}} om {{$article->published->format('H:i')}}
</span>
</div>
</div>
</li>
@endforeach
</ul>
</div>
</div>
@elseif($block->type == 'iframe')
<iframe src="{{ $block->data->url }}" class="article-iframe" id="{{ $id = uniqid('iframe_') }}"></iframe>
<style>
@if(isset($block->data->ratio))
#{{ $id }}.article-iframe {
aspect-ratio: {{ str_replace(":", "/", $block->data->ratio) }};
}
@endif
@if(isset($block->data->ratioMobile))
@media (max-width: 768px) {
#{{ $id }}.article-iframe {
aspect-ratio: {{ str_replace(":", "/", $block->data->ratioMobile) }};
}
}
@endif
</style>
@endif
@endforeach