Merge remote-tracking branch 'origin/master'
# Conflicts: # skolehjem/public/css/admin.css # skolehjem/public/css/webapp.css # skolehjem/public/css/webappdark.css # skolehjem/resources/views/app/news/index.blade.php
This commit is contained in:
commit
e0bbcf8fd0
|
@ -0,0 +1,81 @@
|
|||
const staticCacheName = 'site-static-v2';
|
||||
const dynamicCacheName = 'site-dynamic-v1';
|
||||
const assets = [
|
||||
'/',
|
||||
'/css/app.css',
|
||||
'/css/normalize.css',
|
||||
'/css/webapp.css',
|
||||
'/css/webappdark.css',
|
||||
'/home',
|
||||
'/events'
|
||||
];
|
||||
|
||||
// install event
|
||||
self.addEventListener('install', evt => {
|
||||
//console.log('service worker installed');
|
||||
evt.waitUntil(
|
||||
caches.open(staticCacheName).then((cache) => {
|
||||
console.log('caching shell assets');
|
||||
return cache.addAll(assets);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// activate event
|
||||
self.addEventListener('activate', evt => {
|
||||
//console.log('service worker activated');
|
||||
evt.waitUntil(
|
||||
caches.keys().then(keys => {
|
||||
//console.log(keys);
|
||||
return Promise.all(keys
|
||||
.filter(key => key !== staticCacheName && key !== dynamicCacheName)
|
||||
.map(key => caches.delete(key))
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// fetch event
|
||||
self.addEventListener('fetch', evt => {
|
||||
//console.log('fetch event', evt);
|
||||
evt.respondWith(
|
||||
caches.match(evt.request).then(cacheRes => {
|
||||
return cacheRes || fetch(evt.request).then(fetchRes => {
|
||||
return caches.open(dynamicCacheName).then(cache => {
|
||||
cache.put(evt.request.url, fetchRes.clone()).then(r => {
|
||||
return fetchRes;
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
//Push notification, this is more of a demo you can test in the dev tool
|
||||
self.addEventListener('push', evt => {
|
||||
const title = "Test Notification";
|
||||
const body = "Det her et en demo på hvordan en notification kan se ud! ";
|
||||
const icon = "/icons/browserFavIcon.svg"
|
||||
const tag = "simple-push-example-tag";
|
||||
evt.waitUntil(
|
||||
self.registration.showNotification(title, {
|
||||
body : body,
|
||||
icon : icon,
|
||||
tag : tag
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
function displayNotification(){
|
||||
if(Notification.permission === 'granted'){
|
||||
navigator.serviceWorker.getRegistration()
|
||||
.then(function (reg){
|
||||
reg.showNotification('Helloe ')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//Service Worker Registration
|
||||
|
||||
/*
|
||||
Make sure that we support service worker :)
|
||||
*/
|
||||
|
||||
if('serviceWorker' in navigator){
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker
|
||||
.register('/js/serviceWorkerCachedWebpags.js')
|
||||
.then(reg => console.log("Service Worker has been: registered"))
|
||||
.catch(err => console.log(`Service Worker error: ${err}`))
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Notification.requestPermission().then(function(permission){
|
||||
console.log('Notification permission was:', permission)
|
||||
});
|
||||
|
||||
|
||||
if('caches' in window){
|
||||
console.log("The browser supports caching ")
|
||||
}else {
|
||||
console.log("This browser is some junk, it dosen't support caching :(")
|
||||
}
|
||||
*/
|
|
@ -1,7 +1,11 @@
|
|||
@extends("app.layout.base")
|
||||
@section("title")
|
||||
Home
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<style>
|
||||
.ql-video {
|
||||
iframe, .ql-video {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
@ -32,6 +36,10 @@
|
|||
line-height: 1.5;
|
||||
}
|
||||
|
||||
ol {
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.title{
|
||||
margin-left: 50px;
|
||||
padding: 10px 10px;
|
||||
|
@ -112,7 +120,7 @@
|
|||
|
||||
|
||||
</style>
|
||||
<main class="justify-unset p-none">
|
||||
<main style="justify-content: unset; padding: 0">
|
||||
<?php
|
||||
date_default_timezone_set('Europe/Copenhagen');
|
||||
?>
|
||||
|
@ -127,10 +135,10 @@
|
|||
<span class="createdat">{{__('msg.opret')}}{{ date('Y-m-d H:i:s', strtotime($new->created_at))}}</span>
|
||||
</div>
|
||||
@if($new->resource_id !== null)
|
||||
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="header" style="background-size: cover; background-position: center; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
@endif
|
||||
|
||||
<div class="container mt-1">
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
{!! $new->content !!}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -142,9 +150,9 @@
|
|||
<span class="createdat">{{__('msg.opret')}}{{ date('Y-m-d H:i:s', strtotime($new->created_at))}}</span>
|
||||
</div>
|
||||
@if($new->resource_id !== null)
|
||||
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="header" style="background-size: cover; background-position: center; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
@endif
|
||||
<div class="container mt-1">
|
||||
<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 --}}
|
||||
|
@ -159,32 +167,32 @@
|
|||
<span class="createdat">{{__('msg.opret')}}{{ date('Y-m-d H:i:s', strtotime($new->created_at))}}</span>
|
||||
</div>
|
||||
@if($new->resource_id !== null)
|
||||
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="header" style="background-size: cover; background-position: center; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<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') }} <span class="dot"></span> {{\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->accountable}} </div>
|
||||
<div class="container">
|
||||
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
|
||||
<div class="row justify-content-space pt-1" style="border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||
<div class="row" style="justify-content: space-between; padding-top: 12px; 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)
|
||||
<a class="sde-blue text-center m-none p-none bold" 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 --}}
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $new->arrangement_id }}, this)" >{{__('msg.tilmeld')}}</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.tilmeld')}}</a>
|
||||
@endif
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.show", ["event" => $new->arrangement_id ])}}">{{__('msg.læsmere')}}</a>
|
||||
<a class="sde-blue text-center m-none p-none bold" 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.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>
|
||||
</div>
|
||||
@else
|
||||
<div class="container">
|
||||
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
|
||||
<div class="information2">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->date))->format('d/m/Y \k\l\. H:i') }} <span class="dot"></span> {{\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->accountable}} </div>
|
||||
<div class="row justify-content-space pt-1" style="border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||
<div class="row" style="justify-content: space-between; padding-top: 12px; 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)
|
||||
<a class="sde-blue text-center m-none p-none bold" 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 --}}
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $new->arrangement_id }}, this)" >{{__('msg.tilmeld')}}</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.tilmeld')}}</a>
|
||||
@endif
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.show", ["event" => $new->arrangement_id ])}}">{{__('msg.læsmere')}}</a>
|
||||
<a class="sde-blue text-center m-none p-none bold" 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.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>
|
||||
</div>
|
||||
@endif
|
||||
|
@ -197,15 +205,15 @@
|
|||
</div>
|
||||
@if($new->resource_id !== null)
|
||||
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="information">{{__('msg.kategori')}}: {{\App\GuidesCategory::query()->where('id', '=', \App\Guide::query()->where('id','=', $new->arrangement_id)->first()->guide_category_id)->first()->guidesCategoryName}}</div>
|
||||
<div class="information">{{__('msg.kategori')}} <span class="dot"></span> {{\App\GuidesCategory::query()->where('id', '=', \App\Guide::query()->where('id','=', $new->arrangement_id)->first()->guide_category_id)->first()->guidesCategoryName}}</div>
|
||||
@endif
|
||||
|
||||
<div class="container mt-1">
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
@php $tags = [ '<p>', '<b>', '<em>', '<a>', '<u>', '<s>', '<sub>', '<ul>', '<li>', '<sup>', '<div>', '<blockquote>', '<ol>', '<strong>', '<br>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<h7>', '<span>'] @endphp
|
||||
{!! \App\Helpers::closetags(substr(strip_tags($new->content, $tags), 0, 300)) !!}
|
||||
@if ($new->type == 'Guide') {{-- Else if's displaying guides, then show `Læs mere` --}}
|
||||
<div class="row justify-content-space pt-1" style="border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||
<a href="{{route("guides.show", ["guide" => $new->arrangement_id])}}" class="sde-blue bold">{{__('msg.læsmere')}}</a>
|
||||
<div class="row" style="justify-content: center; padding-top: 12px; 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>
|
||||
|
|
Loading…
Reference in New Issue