diff --git a/.gitignore b/.gitignore index 30fb29663a4f448863b43030a65bccef39cb948f..d4282223c22241df28366753b11bca4059fb7ee5 100755 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ class.pdf class.tex .idea/ media/ +node_modules \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index b5777424c516a92f382dabc0b0b231a9d260d255..12c2380d2e96d54087aef68b2232e0a5f46e84e2 100755 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="JavaScriptLibraryMappings"> - <file url="file://$PROJECT_DIR$" libraries="{jquery-3.2.1}" /> + <file url="file://$PROJECT_DIR$" libraries="{jquery-3.2.1, materialize}" /> </component> </project> \ No newline at end of file diff --git a/.idea/school-apps.iml b/.idea/school-apps.iml index 2cf9edf5ce01568cbcf2fccc68ae2d9d8aadc199..ff011b0b8c44de0e62222059e8531d67338c0544 100755 --- a/.idea/school-apps.iml +++ b/.idea/school-apps.iml @@ -21,6 +21,7 @@ <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="library" name="jquery-3.2.1" level="application" /> <orderEntry type="module" module-name="bwinf-36-2" /> + <orderEntry type="library" name="materialize" level="application" /> </component> <component name="TemplatesService"> <option name="TEMPLATE_CONFIGURATION" value="Django" /> diff --git a/schoolapps/schoolapps/urls.py b/schoolapps/schoolapps/urls.py index 988115f1ee5c86d06e8b1af0b78611385ec24329..d0463198144fb7827151f3d4956d4a2f54912099 100755 --- a/schoolapps/schoolapps/urls.py +++ b/schoolapps/schoolapps/urls.py @@ -13,12 +13,26 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ +import os + from django.conf.urls import include from django.contrib import admin +from django.contrib.staticfiles.views import serve from django.urls import path from django.conf.urls.static import static from django.conf import settings +from schoolapps.settings import BASE_DIR + + +def manifest(request): + return serve(request, "manifest.json") + + +def serviceworker(request): + return serve(request, "common/pwabuilder-sw.js") + + urlpatterns = [ ############# # Dashboard # @@ -50,6 +64,9 @@ urlpatterns = [ ######### path('settings/', include('dbsettings.urls')), path('admin/', admin.site.urls), + + # path("manifest.json", manifest), + path("pwabuilder-sw.js", serviceworker) ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/schoolapps/static/common/manifest.json b/schoolapps/static/common/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9ef2e22feed445d8020284f7c0cf5ce592b2e8c3 --- /dev/null +++ b/schoolapps/static/common/manifest.json @@ -0,0 +1,112 @@ +{ + "dir": "ltr", + "lang": "de", + "name": "SchoolApps – Katharineum zu Lübeck", + "scope": "", + "display": "browser", + "start_url": "https://info.katharineum.de/", + "short_name": "SchoolApps", + "theme_color": "#da1f3d", + "description": "", + "orientation": "portrait", + "background_color": "#ffffff", + "related_applications": [], + "prefer_related_applications": false, + "icons": [ + { + "src": "/static/images/86844799-71f8-10c1-e7d7-796910f44e77.webPlatform.png", + "sizes": "44x44", + "type": "image/png" + }, + { + "src": "/static/images/532d1325-f176-0008-3964-343a1bcd5935.webPlatform.png", + "sizes": "48x48", + "type": "image/png" + }, + { + "src": "/static/images/04f528db-0b01-8c14-7762-7a69810d1265.webPlatform.png", + "sizes": "1240x600", + "type": "image/png" + }, + { + "src": "/static/images/e677beba-e9e4-3000-bca6-c8539dbf74e4.webPlatform.png", + "sizes": "300x300", + "type": "image/png" + }, + { + "src": "/static/images/aa11bd3d-260b-c276-1c09-b767ac224f2e.webPlatform.png", + "sizes": "150x150", + "type": "image/png" + }, + { + "src": "/static/images/8dde8463-278d-5c78-b2f6-f342b026e965.webPlatform.png", + "sizes": "88x88", + "type": "image/png" + }, + { + "src": "/static/images/5d6e255c-1240-2653-ec44-0ea01bff39e6.webPlatform.png", + "sizes": "24x24", + "type": "image/png" + }, + { + "src": "/static/images/9bba1bae-17fb-2975-9edf-a0a90f3a54eb.webPlatform.png", + "sizes": "50x50", + "type": "image/png" + }, + { + "src": "/static/images/d61086e1-4929-90e8-088a-129e4d16b0fa.webPlatform.png", + "sizes": "620x300", + "type": "image/png" + }, + { + "src": "/static/images/6f985a9c-e48a-0035-52b5-4c4b28b8c16d.webPlatform.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/static/images/eaf673aa-e19a-74b4-33c0-d38154cd1b18.webPlatform.png", + "sizes": "144x144", + "type": "image/png" + }, + { + "src": "/static/images/ffdd263d-816e-c2ef-5978-2377f85c42b9.webPlatform.png", + "sizes": "96x96", + "type": "image/png" + }, + { + "src": "/static/images/5e034d01-f259-28a7-7cad-cda2b2758636.webPlatform.png", + "sizes": "72x72", + "type": "image/png" + }, + { + "src": "/static/images/33f6c523-376b-7ee2-4847-cb0e750c3642.webPlatform.png", + "sizes": "36x36", + "type": "image/png" + }, + { + "src": "/static/images/09ec9d1a-7f1a-25e5-97b3-96b90712cc60.webPlatform.png", + "sizes": "1024x1024", + "type": "image/png" + }, + { + "src": "/static/images/061e9652-06e6-8446-46e3-819674db9979.webPlatform.png", + "sizes": "180x180", + "type": "image/png" + }, + { + "src": "/static/images/982059a6-7527-5086-5334-b0252e562f97.webPlatform.png", + "sizes": "152x152", + "type": "image/png" + }, + { + "src": "/static/images/2d819cff-1e82-fcfb-e85a-6090d6b472eb.webPlatform.png", + "sizes": "120x120", + "type": "image/png" + }, + { + "src": "/static/images/8fc2ae6f-6af5-d172-da72-af62f93bc5c0.webPlatform.png", + "sizes": "76x76", + "type": "image/png" + } + ] +} \ No newline at end of file diff --git a/schoolapps/static/common/manup.min.js b/schoolapps/static/common/manup.min.js new file mode 100644 index 0000000000000000000000000000000000000000..1805322c273d0f6055aaad75e6e1f5ebed33b115 --- /dev/null +++ b/schoolapps/static/common/manup.min.js @@ -0,0 +1 @@ +var manUpObject,tagArray=[],linkArray=[],validMetaValues=[{name:"mobile-web-app-capable",manifestName:"display"},{name:"apple-mobile-web-app-capable",manifestName:"display"},{name:"apple-mobile-web-app-title",manifestName:"short_name"},{name:"application-name",manifestName:"short_name"},{name:"msapplication-TileColor",manifestName:"ms_TileColor"},{name:"msapplication-square70x70logo",manifestName:"icons",imageSize:"70x70"},{name:"msapplication-square150x150logo",manifestName:"icons",imageSize:"150x150"},{name:"msapplication-wide310x150logo",manifestName:"icons",imageSize:"310x150"},{name:"msapplication-square310x310logo",manifestName:"icons",imageSize:"310x310"}],validLinkValues=[{name:"apple-touch-icon",manifestName:"icons",imageSize:"152x152"},{name:"apple-touch-icon",manifestName:"icons",imageSize:"120x120"},{name:"apple-touch-icon",manifestName:"icons",imageSize:"76x76"},{name:"apple-touch-icon",manifestName:"icons",imageSize:"60x60"},{name:"apple-touch-icon",manifestName:"icons",imageSize:"57x57"},{name:"apple-touch-icon",manifestName:"icons",imageSize:"72x72"},{name:"apple-touch-icon",manifestName:"icons",imageSize:"114x114"},{name:"icon",manifestName:"icons",imageSize:"128x128"},{name:"icon",manifestName:"icons",imageSize:"192x192"}],generateFullMetaData=function(){for(var e=0;e<validMetaValues.length;e++)if(manUpObject[validMetaValues[e].manifestName])if("icons"==validMetaValues[e].manifestName)for(var a=manUpObject.icons,n=0;n<a.length;n++)a[n].sizes==validMetaValues[e].imageSize&&(validMetaValues[e].content=a[n].src);else validMetaValues[e].content=manUpObject[validMetaValues[e].manifestName],"display"==validMetaValues[e].manifestName&&"standalone"==manUpObject.display&&(validMetaValues[e].content="yes");return validMetaValues},generateFullLinkData=function(){for(var e=0;e<validLinkValues.length;e++)if(manUpObject[validLinkValues[e].manifestName])if("icons"==validLinkValues[e].manifestName)for(var a=manUpObject.icons,n=0;n<a.length;n++)a[n].sizes==validLinkValues[e].imageSize&&(validLinkValues[e].content=a[n].src);else validLinkValues[e].content=manUpObject[validLinkValues[e].manifestName];return validLinkValues},generateMetaArray=function(){for(var e=generateFullMetaData(),a=document.getElementsByTagName("head")[0],n=0;n<e.length;n++){var i=document.createElement("meta");i.name=e[n].name,i.content=e[n].content,a.appendChild(i)}},generateLinkArray=function(){for(var e=generateFullLinkData(),a=document.getElementsByTagName("head")[0],n=0;n<e.length;n++){var i=document.createElement("link");i.setAttribute("rel",e[n].name),i.setAttribute("sizes",e[n].imageSize),i.setAttribute("href",e[n].content),a.appendChild(i)}},generateObj=function(e){manUpObject=JSON.parse(e),generateLinkArray(),generateMetaArray()},makeAjax=function(e){if(window.XMLHttpRequest){var a,n=/^https?:\/\//i;n.test(e)?fulURL=e:a=window.location.hostname+e;var i=new XMLHttpRequest;i.onreadystatechange=function(){4==i.readyState&&200==i.status&&generateObj(i.responseText)},i.open("GET",e,!0),i.send()}},collectManifestObj=function(){for(var e=document.getElementsByTagName("link"),a=0;a<e.length;a++)e[a].rel&&"manifest"==e[a].rel&&makeAjax(e[a].href)},testForManifest=function(){collectManifestObj()}(); \ No newline at end of file diff --git a/schoolapps/static/common/pwabuilder-sw-register.js b/schoolapps/static/common/pwabuilder-sw-register.js new file mode 100644 index 0000000000000000000000000000000000000000..3fba63945c18c6c4afc7808dab663b63d83cbda0 --- /dev/null +++ b/schoolapps/static/common/pwabuilder-sw-register.js @@ -0,0 +1,14 @@ +//This is the "Offline copy of pages" service worker + +//Add this below content to your HTML page, or add the js file to your page at the very top to register service worker +if (navigator.serviceWorker.controller) { + console.log('[PWA Builder] active service worker found, no need to register') +} else { + //Register the ServiceWorker + navigator.serviceWorker.register('pwabuilder-sw.js', { + scope: './' + }).then(function (reg) { + console.log('Service worker has been registered for scope:' + reg.scope); + }); +} + diff --git a/schoolapps/static/common/pwabuilder-sw.js b/schoolapps/static/common/pwabuilder-sw.js new file mode 100644 index 0000000000000000000000000000000000000000..18ddd2d0aaa8f9e22a3010136987c53c66a1f642 --- /dev/null +++ b/schoolapps/static/common/pwabuilder-sw.js @@ -0,0 +1,43 @@ +//This is the "Offline copy of pages" service worker + +//Install stage sets up the index page (home page) in the cache and opens a new cache +self.addEventListener('install', function (event) { + var indexPage = new Request('/'); + event.waitUntil( + fetch(indexPage).then(function (response) { + return caches.open('pwabuilder-offline').then(function (cache) { + console.log('[PWA Builder] Cached index page during Install' + response.url); + return cache.put(indexPage, response); + }); + })); +}); + +//If any fetch fails, it will look for the request in the cache and serve it from there first +self.addEventListener('fetch', function (event) { + var updateCache = function (request) { + return caches.open('pwabuilder-offline').then(function (cache) { + return fetch(request).then(function (response) { + console.log('[PWA Builder] add page to offline' + response.url) + return cache.put(request, response); + }); + }); + }; + + event.waitUntil(updateCache(event.request)); + + event.respondWith( + fetch(event.request).catch(function (error) { + console.log('[PWA Builder] Network request Failed. Serving content from cache: ' + error); + + //Check to see if you have it in the cache + //Return response + //If not in the cache, then return error page + return caches.open('pwabuilder-offline').then(function (cache) { + return cache.match(event.request).then(function (matching) { + var report = !matching || matching.status === 404 ? Promise.reject('no-match') : matching; + return report + }); + }); + }) + ); +}) diff --git a/schoolapps/static/images/04f528db-0b01-8c14-7762-7a69810d1265.webPlatform.png b/schoolapps/static/images/04f528db-0b01-8c14-7762-7a69810d1265.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..5fdc2bedb0feebc69f2b98992fc4ca1ae6bdcc62 Binary files /dev/null and b/schoolapps/static/images/04f528db-0b01-8c14-7762-7a69810d1265.webPlatform.png differ diff --git a/schoolapps/static/images/061e9652-06e6-8446-46e3-819674db9979.webPlatform.png b/schoolapps/static/images/061e9652-06e6-8446-46e3-819674db9979.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..6ec6a6ffa2055d6f9de91973e896acfcfc442158 Binary files /dev/null and b/schoolapps/static/images/061e9652-06e6-8446-46e3-819674db9979.webPlatform.png differ diff --git a/schoolapps/static/images/09ec9d1a-7f1a-25e5-97b3-96b90712cc60.webPlatform.png b/schoolapps/static/images/09ec9d1a-7f1a-25e5-97b3-96b90712cc60.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..ae0aae6bbbe7bb075a3d484618876a2d4045a079 Binary files /dev/null and b/schoolapps/static/images/09ec9d1a-7f1a-25e5-97b3-96b90712cc60.webPlatform.png differ diff --git a/schoolapps/static/images/2d819cff-1e82-fcfb-e85a-6090d6b472eb.webPlatform.png b/schoolapps/static/images/2d819cff-1e82-fcfb-e85a-6090d6b472eb.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..1504d5df5b5e5bbb2ed4b956ccc014dbddb0021b Binary files /dev/null and b/schoolapps/static/images/2d819cff-1e82-fcfb-e85a-6090d6b472eb.webPlatform.png differ diff --git a/schoolapps/static/images/33f6c523-376b-7ee2-4847-cb0e750c3642.webPlatform.png b/schoolapps/static/images/33f6c523-376b-7ee2-4847-cb0e750c3642.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..9438927139720f8cb62c5b554bcfc82196cf5b56 Binary files /dev/null and b/schoolapps/static/images/33f6c523-376b-7ee2-4847-cb0e750c3642.webPlatform.png differ diff --git a/schoolapps/static/images/532d1325-f176-0008-3964-343a1bcd5935.webPlatform.png b/schoolapps/static/images/532d1325-f176-0008-3964-343a1bcd5935.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..45f297cdbaff95d08f776aa809a16b19d8a67728 Binary files /dev/null and b/schoolapps/static/images/532d1325-f176-0008-3964-343a1bcd5935.webPlatform.png differ diff --git a/schoolapps/static/images/5d6e255c-1240-2653-ec44-0ea01bff39e6.webPlatform.png b/schoolapps/static/images/5d6e255c-1240-2653-ec44-0ea01bff39e6.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..4f941ec1a92616c33445d5dab6937410a4455cad Binary files /dev/null and b/schoolapps/static/images/5d6e255c-1240-2653-ec44-0ea01bff39e6.webPlatform.png differ diff --git a/schoolapps/static/images/5e034d01-f259-28a7-7cad-cda2b2758636.webPlatform.png b/schoolapps/static/images/5e034d01-f259-28a7-7cad-cda2b2758636.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..dddf7371ba8f03464e98acbfd521549d4f3027e9 Binary files /dev/null and b/schoolapps/static/images/5e034d01-f259-28a7-7cad-cda2b2758636.webPlatform.png differ diff --git a/schoolapps/static/images/6f985a9c-e48a-0035-52b5-4c4b28b8c16d.webPlatform.png b/schoolapps/static/images/6f985a9c-e48a-0035-52b5-4c4b28b8c16d.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..66f858f3ae486fa52fad800005956830c2948002 Binary files /dev/null and b/schoolapps/static/images/6f985a9c-e48a-0035-52b5-4c4b28b8c16d.webPlatform.png differ diff --git a/schoolapps/static/images/86844799-71f8-10c1-e7d7-796910f44e77.webPlatform.png b/schoolapps/static/images/86844799-71f8-10c1-e7d7-796910f44e77.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..ed3bf0ecd7bf159a55b5b5c542f69e79bf658555 Binary files /dev/null and b/schoolapps/static/images/86844799-71f8-10c1-e7d7-796910f44e77.webPlatform.png differ diff --git a/schoolapps/static/images/8dde8463-278d-5c78-b2f6-f342b026e965.webPlatform.png b/schoolapps/static/images/8dde8463-278d-5c78-b2f6-f342b026e965.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..8c1a9257b31d06f141965bb657292cf706d27056 Binary files /dev/null and b/schoolapps/static/images/8dde8463-278d-5c78-b2f6-f342b026e965.webPlatform.png differ diff --git a/schoolapps/static/images/8fc2ae6f-6af5-d172-da72-af62f93bc5c0.webPlatform.png b/schoolapps/static/images/8fc2ae6f-6af5-d172-da72-af62f93bc5c0.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..8083bfab54c50d4c4c67e296d37d46859996f1dd Binary files /dev/null and b/schoolapps/static/images/8fc2ae6f-6af5-d172-da72-af62f93bc5c0.webPlatform.png differ diff --git a/schoolapps/static/images/982059a6-7527-5086-5334-b0252e562f97.webPlatform.png b/schoolapps/static/images/982059a6-7527-5086-5334-b0252e562f97.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..6ca6247bb9edac56d3cfc9ebb25257cef309a477 Binary files /dev/null and b/schoolapps/static/images/982059a6-7527-5086-5334-b0252e562f97.webPlatform.png differ diff --git a/schoolapps/static/images/9bba1bae-17fb-2975-9edf-a0a90f3a54eb.webPlatform.png b/schoolapps/static/images/9bba1bae-17fb-2975-9edf-a0a90f3a54eb.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..4e5ff63b7cbb327363e0243e8a06812942bd0a1c Binary files /dev/null and b/schoolapps/static/images/9bba1bae-17fb-2975-9edf-a0a90f3a54eb.webPlatform.png differ diff --git a/schoolapps/static/images/aa11bd3d-260b-c276-1c09-b767ac224f2e.webPlatform.png b/schoolapps/static/images/aa11bd3d-260b-c276-1c09-b767ac224f2e.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..db96282a1a185ab77226279f8958392ef626d901 Binary files /dev/null and b/schoolapps/static/images/aa11bd3d-260b-c276-1c09-b767ac224f2e.webPlatform.png differ diff --git a/schoolapps/static/images/d61086e1-4929-90e8-088a-129e4d16b0fa.webPlatform.png b/schoolapps/static/images/d61086e1-4929-90e8-088a-129e4d16b0fa.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..003a2206d8553c41166903445c9c5d4d6a4a23fd Binary files /dev/null and b/schoolapps/static/images/d61086e1-4929-90e8-088a-129e4d16b0fa.webPlatform.png differ diff --git a/schoolapps/static/images/e677beba-e9e4-3000-bca6-c8539dbf74e4.webPlatform.png b/schoolapps/static/images/e677beba-e9e4-3000-bca6-c8539dbf74e4.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..59235792e1c86ef6b847c7c79c579e6902f72bc7 Binary files /dev/null and b/schoolapps/static/images/e677beba-e9e4-3000-bca6-c8539dbf74e4.webPlatform.png differ diff --git a/schoolapps/static/images/eaf673aa-e19a-74b4-33c0-d38154cd1b18.webPlatform.png b/schoolapps/static/images/eaf673aa-e19a-74b4-33c0-d38154cd1b18.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..002ef0b644f0b9be0042578b05db166359ddff65 Binary files /dev/null and b/schoolapps/static/images/eaf673aa-e19a-74b4-33c0-d38154cd1b18.webPlatform.png differ diff --git a/schoolapps/static/images/ffdd263d-816e-c2ef-5978-2377f85c42b9.webPlatform.png b/schoolapps/static/images/ffdd263d-816e-c2ef-5978-2377f85c42b9.webPlatform.png new file mode 100644 index 0000000000000000000000000000000000000000..e56b4494e3843a37e6d052f8918c4762ac15a817 Binary files /dev/null and b/schoolapps/static/images/ffdd263d-816e-c2ef-5978-2377f85c42b9.webPlatform.png differ diff --git a/schoolapps/static/materialize b/schoolapps/static/materialize index 5714e3b8821ba2cc6831064e7cb901e743e19b58..80e8ed370487aaf1e2185b028f7deda40da94eb9 160000 --- a/schoolapps/static/materialize +++ b/schoolapps/static/materialize @@ -1 +1 @@ -Subproject commit 5714e3b8821ba2cc6831064e7cb901e743e19b58 +Subproject commit 80e8ed370487aaf1e2185b028f7deda40da94eb9 diff --git a/schoolapps/templates/partials/header.html b/schoolapps/templates/partials/header.html index cde9628a99c30112bec7b823420f3780156b0998..26fba49a929089ee87d1b599e1faa422fcd56117 100755 --- a/schoolapps/templates/partials/header.html +++ b/schoolapps/templates/partials/header.html @@ -8,7 +8,8 @@ <title>SchoolApps – Katharineum zu Lübeck</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Favicon --> - <link rel="shortcut icon" type="image/png" href="{% static 'common/favicon.ico' %}"/> + <link rel="shortcut icon" type="image/png" href="{% static 'common/favicon.ico' %}"> + <link rel="manifest" href="{% static "common/manifest.json" %}"> <!---------> <!-- CSS --> @@ -23,6 +24,9 @@ <!----------------> <!-- JavaScript --> <!----------------> + <script src="{% static 'common/manup.min.js' %}"></script> + {# <script src="{% static "common/pwabuilder-sw.js"%}"></script>#} + <script src="{% static "common/pwabuilder-sw-register.js" %}"></script> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <!--<script src="{% static 'materialize/dist/js/materialize.min.js' %}"></script>--> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>