Merge remote-tracking branch 'origin/master'
# Conflicts: # skolehjem/app/Http/Controllers/RootController.php # skolehjem/resources/views/app/news/index.blade.php
This commit is contained in:
commit
9b26e5f1af
|
@ -31,13 +31,12 @@ class RootController extends Controller
|
||||||
if(Response::detect("root.index")->name() == "admin.root.index")
|
if(Response::detect("root.index")->name() == "admin.root.index")
|
||||||
return view("admin.root.index");
|
return view("admin.root.index");
|
||||||
else {
|
else {
|
||||||
|
$news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->orderBy('id', 'desc')->get();
|
||||||
$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()->join('news_types', 'news_types.id', '=', 'news.type_id')->orderBy('id', 'desc')->paginate($perPage, ['*'], "page");
|
$news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->orderBy('id', 'desc')->get();
|
||||||
|
|
||||||
return Response::detect('root.index', ["news" => $news]);
|
return Response::detect('root.index', ["news" => $news]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,15 +34,49 @@
|
||||||
ol {
|
ol {
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*Alert box*/
|
||||||
|
.alert {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f44336;
|
||||||
|
color: white;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closebtn {
|
||||||
|
margin-left: 15px;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
float: right;
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.closebtn:hover {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
alertBoxBackground {
|
||||||
|
margin-top: 1rem;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
width: auto;
|
||||||
|
heigt: auto;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1 class="text-center sde-blue mb-0" style="margin-bottom: 2rem">{{ __('msg.aktiviteter') }}</h1>
|
<h1 class="text-center sde-blue mb-0" style="margin-bottom: 2rem">{{ __('msg.aktiviteter') }}</h1>
|
||||||
|
|
||||||
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
|
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
|
||||||
<div class="card" id="notifications">
|
<div class="alertBoxBackground" id="notifications">
|
||||||
<div class="container" style="margin-top: 8px;">
|
<div class="alert">
|
||||||
<button style="margin-left: calc(100% - 1rem - 8px); border-radius: 50%; background-color: #00788a; color: white; border: 1px solid grey;" onclick="deleteNotifications(document.getElementById('notifications'))">X</button>
|
<span class="closebtn" onclick="deleteNotifications(document.getElementById('notifications'))">×</span>
|
||||||
|
<strong>Event Canceled</strong>
|
||||||
@foreach(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get() as $notification)
|
@foreach(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get() as $notification)
|
||||||
<p>{{ $notification->message }}{{ __("msg.canceled") }}</p>
|
<p>{{ $notification->message }}{{ __("msg.canceled") }}</p>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
|
@ -30,31 +30,88 @@
|
||||||
ol {
|
ol {
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title{
|
||||||
|
margin-left: 50px;
|
||||||
|
padding: 10px 10px;
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.img{
|
||||||
|
width: 1em;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-left: 5px;
|
||||||
|
font-size: 20px;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-color: cadetblue;
|
||||||
|
border-radius: 100%;
|
||||||
|
background-color: cadetblue;
|
||||||
|
line-height: 30px;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.information{
|
||||||
|
text-align: center;
|
||||||
|
background-color: rgba(211, 211, 211, 0.3);
|
||||||
|
width: 100%;
|
||||||
|
height: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card > .img > a > img, .card > .img > img {
|
||||||
|
width: 100%;
|
||||||
|
} {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,body,main{
|
||||||
|
background-color: rgb(200,200,200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<main style="justify-content: unset;">
|
<main style="justify-content: unset;">
|
||||||
@foreach($news as $new)
|
@foreach($news as $new)
|
||||||
<div class="card">
|
<!--Code to list events-->
|
||||||
@if($new->resource_id !== null)
|
@if($new->type == 'News')<!--Code that prints news-->
|
||||||
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');">
|
<div class="card">
|
||||||
<p style="text-shadow: 2px 2px 2px #00788A;"><b>{{ $new->name }}</b></p>
|
<div class="img"><img src="{{URL::asset('/images/icons/news.svg')}}" alt="News:"></div>
|
||||||
<h3 style="text-shadow: 2px 2px 2px #00788A;">{{ $new->subname }}</h3>
|
<div class="title">{{ $new->subname }}</div>
|
||||||
</div>
|
@if($new->resource_id !== null)
|
||||||
@else
|
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||||
<div class="header">
|
@endif
|
||||||
<p><b>{{ $new->name }}</b></p>
|
|
||||||
<h3>{{ $new->subname }}</h3>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="container" style="margin-top: 8px;">
|
<div class="container" style="margin-top: 8px;">
|
||||||
@if ($new->type == 'News' || $new->type == 'Menu') {{-- If it's a news or menu then display the whole message --}}
|
{!! $new->content !!}
|
||||||
{!! $new->content !!}
|
</div>
|
||||||
@else {{-- If it's a menu, guide or event. Then display up to 300 characters of text --}}
|
</div>
|
||||||
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
|
@elseif($new->type == 'Menu')<!--Code that prints menuplan -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="img"><a href="{{ route('menu-plans.index') }}"><img src="{{URL::asset('/images/icons/Menuplan.svg')}}" alt="Menuplan:"></a></div>
|
||||||
|
<div class="title">{{ $new->subname }}</div>
|
||||||
|
@if($new->resource_id !== null)
|
||||||
|
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||||
|
@endif
|
||||||
|
<div class="container" style="margin-top: 8px;">
|
||||||
|
@if ($new->type == 'News' || $new->type == 'Menu') {{-- If it's a news or menu then display the whole message --}}
|
||||||
|
{!! $new->content !!}
|
||||||
|
@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) ) !!}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@elseif($new->type == 'Activity')<!--Code that prints events-->
|
||||||
|
<div class="card">
|
||||||
|
<div class="img"><a href="{{ route('events.index') }}"><img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Aktiviteter:"></a></div>
|
||||||
|
<div class="title">{{ $new->subname }}</div>
|
||||||
|
@if($new->resource_id !== null)
|
||||||
|
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||||
@endif
|
@endif
|
||||||
|
<div class="information">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->date))->format('d/m/Y \k\l\. H:i') }} | {{\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->accountable}} </div>
|
||||||
@if ($new->type == 'Activity') {{-- If it's displaying an event, then show `Tilmeld`, `Læs mere` & `Se deltagere` --}}
|
<div class="container">
|
||||||
<div class="row" style="justify-content: space-between; margin-top: 16px;">
|
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
|
||||||
|
<div class="row" style="justify-content: space-between; margin-top: 16px; border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||||
@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>
|
||||||
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
||||||
|
@ -63,13 +120,27 @@
|
||||||
<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 == 'Guide') {{-- Else if's displaying guides, then show `Læs mere` --}}
|
</div>
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
@endif {{-- Else if it's a menu or news, then don't show a button at bottom --}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@else<!--Code that prints guides-->
|
||||||
|
<div class="card">
|
||||||
|
<div class="img"><a href="{{ route('guides.index') }}"><img src="{{URL::asset('/images/icons/Vejledninger.svg')}}" alt="Vejledninger:"></a></div>
|
||||||
|
<div class="title">{{ $new->subname }}</div>
|
||||||
|
@if($new->resource_id !== null)
|
||||||
|
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="container" style="margin-top: 8px;">
|
||||||
|
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
|
||||||
|
@if ($new->type == 'Guide') {{-- Else if's displaying guides, then show `Læs mere` --}}
|
||||||
|
<div class="row" style="justify-content: center; border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||||
|
<a style="font-weight: 700;" href="{{route("guides.show", ["guide" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
|
||||||
|
</div>
|
||||||
|
@endif {{-- Else if it's a menu or news, then don't show a button at bottom --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
||||||
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
||||||
|
|
Loading…
Reference in New Issue