Commit ae416d31 authored by Björn Eyselein's avatar Björn Eyselein
Browse files

Update: PWA

parent 4a477667
if ('serviceWorker' in navigator) {
console.warn('Installing service worker...');
navigator.serviceWorker.register('service-worker.js', {scope: '/'})
.then(registration => console.log(registration))
.catch(error => console.error(error));
}
\ No newline at end of file
self.addEventListener('install', event => {
console.warn('Installing service worker...' + event);
});
self.addEventListener('fetch', event => {
console.info(event);
});
\ No newline at end of file
......@@ -6,7 +6,11 @@
"Startseite"
}
@main(title, Some(user)) {
@scripts = {
<script src="@routes.Assets.versioned("app.js")"></script>
}
@main(title, Some(user), scripts) {
<h2 class="center-align">Meine Kurse</h2>
......
......@@ -3,21 +3,21 @@
@(title: String, maybeUser: Option[User], scripts: Html = Html(""))(content: Html)
@navigation = {
@maybeUser match {
case Some(user) => {
@if(user.isAdmin) {
<li><a href="@routes.AdminController.index">Administration</a></li>
}
<li><a href="@routes.HomeController.userPage">Nutzer: @user.username </a></li>
<li><a href="@routes.HomeController.allLanguages">Alle Sprachen</a></li>
<li><a href="@routes.LoginController.logout">Logout</a></li>
}
case None => {
<li><a href="@routes.LoginController.loginForm">Login</a></li>
<li><a href="@routes.LoginController.registerForm">Registrieren</a></li>
@maybeUser match {
case Some(user) => {
@if(user.isAdmin) {
<li><a href="@routes.AdminController.index">Administration</a></li>
}
<li><a href="@routes.HomeController.userPage">Nutzer: @user.username </a></li>
<li><a href="@routes.HomeController.allLanguages">Alle Sprachen</a></li>
<li><a href="@routes.LoginController.logout">Logout</a></li>
}
case None => {
<li><a href="@routes.LoginController.loginForm">Login</a></li>
<li><a href="@routes.LoginController.registerForm">Registrieren</a></li>
}
}
}
<!DOCTYPE html>
<html lang="de">
......@@ -28,6 +28,8 @@
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="@routes.Assets.versioned("lib/materialize-css/dist/css/materialize.css")">
<link rel="manifest" href="/manifest.json">
</head>
<body>
......
......@@ -15,7 +15,11 @@ val webJarDependencies = Seq(
"org.webjars.npm" % "jquery" % "3.3.1",
"org.webjars.npm" % "types__jquery" % "3.3.29",
"org.webjars.npm" % "materialize-css" % "1.0.0"
"org.webjars.npm" % "materialize-css" % "1.0.0",
// javascript db
"org.webjars.npm" % "dexie" % "2.0.4"
)
dependencyOverrides ++= Seq(
......
......@@ -2,6 +2,12 @@
GET / controllers.HomeController.index
# Service worker, etc.
GET /service-worker.js controllers.Assets.at(path="/public", file="serviceWorker.js")
GET /manifest.json controllers.Assets.at(path="/public", file="wuekabel.webmanifest")
GET /sw.js controllers.Assets.at(path="/public", file="sw.js")
# User management
GET /registerForm controllers.LoginController.registerForm
......
{
"name": "Wuekabel",
"short_name": "wuekabel",
"icons": [],
"scope": "/",
"display": "standalone",
"theme_color": "black",
"background_color": "white"
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment