v0.10.20a - Changed type_id to type on news.index, so it's no longer a number

This commit is contained in:
Anders 2020-08-31 14:31:56 +02:00
parent bccd00683f
commit cf1baac983
2 changed files with 5 additions and 5 deletions

View File

@ -32,12 +32,12 @@ class RootController extends Controller
return view("admin.root.index"); return view("admin.root.index");
else { else {
$news = News::query()->orderBy('id', 'desc')->paginate($perPage); $news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->orderBy('id', 'desc')->paginate($perPage);
return view("app.root.index", ["news" => $news]); return view("app.root.index", ["news" => $news]);
} }
} }
else { else {
$news = News::query()->orderBy('id', 'desc')->paginate($perPage, ['*'], "page"); $news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->orderBy('id', 'desc')->paginate($perPage, ['*'], "page");
return Response::detect('root.index', ["news" => $news]); return Response::detect('root.index', ["news" => $news]);
} }

View File

@ -47,13 +47,13 @@
@endif @endif
<div class="container" style="margin-top: 8px;"> <div class="container" style="margin-top: 8px;">
@if ($new->type_id == 1 || $new->type_id == 2) {{-- If it's a news or menu then display the whole message --}} @if ($new->type == 'News' || $new->type == 'Menu') {{-- If it's a news or menu then display the whole message --}}
{!! $new->content !!} {!! $new->content !!}
@else {{-- If it's a menu, guide or event. Then display up to 300 characters of text --}} @else {{-- If it's a menu, guide or event. Then display up to 300 characters of text --}}
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!} {!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
@endif @endif
@if ($new->type_id == 3) {{-- If it's displaying an event, then show `Tilmeld`, `Læs mere` & `Se deltagere` --}} @if ($new->type == 'Activity') {{-- If it's displaying an event, then show `Tilmeld`, `Læs mere` & `Se deltagere` --}}
<div class="row" style="justify-content: space-between; margin-top: 16px;"> <div class="row" style="justify-content: space-between; margin-top: 16px;">
@if (count(\App\UserEvent::query()->where('event_id', '=', $new->arrangement_id)->where('user_id', '=', Auth::user()->id)->get()) > 0) @if (count(\App\UserEvent::query()->where('event_id', '=', $new->arrangement_id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:void(0);" onclick="ajaxCall({{ $new->arrangement_id }}, this)" >{{__('msg.afmeld')}}</a> <a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:void(0);" onclick="ajaxCall({{ $new->arrangement_id }}, this)" >{{__('msg.afmeld')}}</a>
@ -63,7 +63,7 @@
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.show", ["event" => $new->arrangement_id ])}}">{{__('msg.læsmere')}}</a> <a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.show", ["event" => $new->arrangement_id ])}}">{{__('msg.læsmere')}}</a>
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.accountsignups", ["event" => $new->arrangement_id ])}}">{{__('msg.sedeltagere')}}</a> <a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.accountsignups", ["event" => $new->arrangement_id ])}}">{{__('msg.sedeltagere')}}</a>
</div> </div>
@elseif ($new->type_id == 4) {{-- Else if's displaying guides, then show `Læs mere` --}} @elseif ($new->type == 'Guide') {{-- Else if's displaying guides, then show `Læs mere` --}}
<div class="row" style="justify-content: center"> <div class="row" style="justify-content: center">
<a style="font-weight: 700;" href="{{route("guides.show", ["guide" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a> <a style="font-weight: 700;" href="{{route("guides.show", ["guide" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
</div> </div>