Show at most 4 categories, the rest behind a '+N' tag
- New partial/tag_list: first 4 categories, then a '+N' tag that opens the remaining ones (hover/keyboard on desktop, tap on touch screens; short close delay so the mouse can reach the list) - Used on the homepage, the article page and the news overview / tag pages (the latter now use the same pills instead of text links) - Article page: tag row grows when the tags wrap (was a fixed height) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f7b1dbac8f
commit
df8c8a9c4f
10 files changed
+325
-32
No files matched your search
@@ -24,12 +24,7 @@ Home
|
||||
</a>
|
||||
<div class="slider_content_box">
|
||||
<ul class="post_details simple">
|
||||
@foreach($item->tags as $tag)
|
||||
<li class="category">
|
||||
<a title="{{$tag->titel}}" href="{{route('nieuws.tag', ['tag' => $tag->slug])}}"
|
||||
class="over_image">{{$tag->titel}}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@include('partial/tag_list', ['tags' => $item->tags, 'itemClass' => 'category', 'linkClass' => 'over_image'])
|
||||
</ul>
|
||||
<h2><a href="{{url($item->url)}}" title="{{$item->title}}">{!!$item->title!!}</a></h2>
|
||||
<?php
|
||||
@@ -59,12 +54,7 @@ Home
|
||||
</a>
|
||||
<div class="slider_content_box">
|
||||
<ul class="post_details simple">
|
||||
@foreach($item->tags as $tag)
|
||||
<li class="category">
|
||||
<a title="{{$tag->titel}}" href="{{route('nieuws.tag', ['tag' => $tag->slug])}}"
|
||||
class="over_image">{{$tag->titel}}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@include('partial/tag_list', ['tags' => $item->tags, 'itemClass' => 'category', 'linkClass' => 'over_image'])
|
||||
</ul>
|
||||
<h2><a href="{{url($item->url)}}" title="{{$item->title}}">{!!$item->title!!}</a></h2>
|
||||
<?php
|
||||
@@ -98,12 +88,7 @@ Home
|
||||
</a>
|
||||
<div class="slider_content_box">
|
||||
<ul class="post_details simple">
|
||||
@foreach($item->tags as $tag)
|
||||
<li class="category">
|
||||
<a title="{{$tag->titel}}" href="{{route('nieuws.tag', ['tag' => $tag->slug])}}"
|
||||
class="over_image">{{$tag->titel}}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@include('partial/tag_list', ['tags' => $item->tags, 'itemClass' => 'category', 'linkClass' => 'over_image'])
|
||||
</ul>
|
||||
<h5 class="post_title"><a href="{{url($item->url)}}"
|
||||
title="{{$item->title}}">{!!$item->title!!}</a></h5>
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
|
||||
@section('tags')
|
||||
<ul class="post_tags">
|
||||
@foreach($news->tags as $tag)
|
||||
<li><a href="{{route('nieuws.tag', $tag->slug)}}" title="{{$tag->titel}}">{{$tag->titel}}</a></li>
|
||||
@endforeach
|
||||
@include('partial/tag_list', ['tags' => $news->tags])
|
||||
</ul>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -47,15 +47,15 @@
|
||||
<img src='{{$item->images && count($item->images) ? $imgBase . $item->images[0]->url : '/images/noimage.svg'}}'
|
||||
alt='img'>
|
||||
</a>
|
||||
@if($item->tags)
|
||||
<ul class="post_tags">
|
||||
@include('partial/tag_list', ['tags' => $item->tags])
|
||||
</ul>
|
||||
@endif
|
||||
<h2 class="post_title"><a href="{{url($item->url)}}"
|
||||
title="{{strip_tags($item->title)}}">{!!$item->title!!}</a>
|
||||
</h2>
|
||||
<ul class="post_details clearfix">
|
||||
@foreach($item->tags as $tag)
|
||||
<li class="detail category"><i class="fa-solid fa-location-dot"></i> <a
|
||||
href="{{route('nieuws.tag', $tag->slug)}}"
|
||||
title="{{$tag->titel}}">{{$tag->titel}}</a></li>
|
||||
@endforeach
|
||||
@if($item->edited && ($item->edited != $item->published))
|
||||
<li class="date edited">
|
||||
<i class="fa-regular fa-clock"></i>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{{--
|
||||
Category tags of a news item as <li> elements (place inside a <ul>).
|
||||
Shows at most $max tags; the rest is behind a "+N" tag that opens a list
|
||||
on hover, keyboard focus or tap (see resources/assets/js/functions/tags.js).
|
||||
|
||||
Parameters:
|
||||
$tags the tags (objects with ->titel and ->slug)
|
||||
$max number of visible tags (default 4)
|
||||
$itemClass class for each <li> (e.g. 'category' on the homepage)
|
||||
$linkClass class for each <a>
|
||||
--}}
|
||||
@php
|
||||
$tags = is_array($tags ?? null) ? $tags : [];
|
||||
$max = $max ?? 4;
|
||||
$itemClass = $itemClass ?? '';
|
||||
$linkClass = $linkClass ?? '';
|
||||
$visible = array_slice($tags, 0, $max);
|
||||
$hidden = array_slice($tags, $max);
|
||||
@endphp
|
||||
@foreach($visible as $tag)
|
||||
<li class="{{ $itemClass }}"><a class="{{ $linkClass }}" href="{{ route('nieuws.tag', ['tag' => $tag->slug]) }}" title="{{ $tag->titel }}">{{ $tag->titel }}</a></li>
|
||||
@endforeach
|
||||
@if($hidden)
|
||||
<li class="{{ $itemClass }} tags_more">
|
||||
<a class="{{ $linkClass }} tags_more_toggle" href="#" role="button" aria-expanded="false"
|
||||
title="Nog {{ count($hidden) }} categorieën"
|
||||
aria-label="Nog {{ count($hidden) }} categorieën: {{ implode(', ', array_map(function ($tag) { return $tag->titel; }, $hidden)) }}">+{{ count($hidden) }}</a>
|
||||
<ul class="tags_more_list">
|
||||
@foreach($hidden as $tag)
|
||||
<li class="{{ $itemClass }}"><a class="{{ $linkClass }}" href="{{ route('nieuws.tag', ['tag' => $tag->slug]) }}" title="{{ $tag->titel }}">{{ $tag->titel }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</li>
|
||||
@endif
|
||||
Reference in new issue
Block a user