v0.9.0 - Added individual Read more buttons on news.index
Added NewsType - To see if it's a news, menu, guide or event Added type column to News type_id & arrangement_id (Both needed to see what type (menu,guide,news,event) and arrangement(The individual types ID)) Added NewsTypeSeeder.php Fixed CSS Added & Fixed messages en/dk Fixed Editors Added routing when removing yourself from an event, on events.index
This commit is contained in:
@@ -29,22 +29,43 @@
|
||||
</style>
|
||||
<main style="justify-content: unset;">
|
||||
@foreach(\App\News::query()->orderBy("created_at", "desc")->get() as $new)
|
||||
<div class="card">
|
||||
@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) }}');">
|
||||
<p style="text-shadow: 2px 2px 2px #00078A;"><b>{{ $new->name }}</b></p>
|
||||
<h3 style="text-shadow: 2px 2px 2px #00078A;">{{ $new->subname }}</h3>
|
||||
<div class="card">
|
||||
@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) }}');">
|
||||
<p style="text-shadow: 2px 2px 2px #00078A;"><b>{{ $new->name }}</b></p>
|
||||
<h3 style="text-shadow: 2px 2px 2px #00078A;">{{ $new->subname }}</h3>
|
||||
</div>
|
||||
@else
|
||||
<div class="header">
|
||||
<p><b>{{ $new->name }}</b></p>
|
||||
<h3>{{ $new->subname }}</h3>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<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 --}}
|
||||
{!! $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
|
||||
|
||||
@if ($new->type_id == 3) {{-- 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;">
|
||||
@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="ajaxCallCancel({{ $new->arrangement_id }})" >{{__('msg.afmeld')}}</a>
|
||||
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:void(0);" onclick="ajaxCall({{ $new->arrangement_id }})" >{{__('msg.tilmeld')}}</a>
|
||||
@endif
|
||||
<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>
|
||||
</div>
|
||||
@elseif ($new->type_id == 4) {{-- Else if's displaying guides, then show `Læs mere` --}}
|
||||
<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>
|
||||
@else
|
||||
<div class="header">
|
||||
<p><b>{{ $new->name }}</b></p>
|
||||
<h3>{{ $new->subname }}</h3>
|
||||
</div>
|
||||
@endif
|
||||
<div class="container">
|
||||
{!! $new->content !!}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
||||
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
||||
@@ -58,10 +79,12 @@
|
||||
var x = document.getElementById("snackbar");
|
||||
x.innerHTML = data;
|
||||
x.className = "show";
|
||||
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
}
|
||||
|
||||
function ajaxCall(event_id) {
|
||||
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
@@ -70,10 +93,26 @@
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
setTimeout(function(){document.location.reload(false)}, 2000);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxCallCancel(event_id) {
|
||||
|
||||
axios.post("{{ route("userevents.createajaxcancel") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
setTimeout(function(){document.location.reload(false)}, 2000);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user