Enable installing app as pwa

This commit is contained in:
Mirna Milic
2025-05-28 17:23:07 +02:00
parent 54da8c70e3
commit 5879bc3faf
11 changed files with 60 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
<html lang="<%= I18n.locale %>">
<head>
<title><%= content_for?(:title) ? yield(:title) : "Terminator" %></title>
<link rel="manifest" crossorigin="use-credentials" href="/manifest.json" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

View File

@@ -2,6 +2,7 @@
<html>
<head>
<title>Terminator</title>
<link rel="manifest" crossorigin="use-credentials" href="/manifest.json" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

View File

@@ -0,0 +1,21 @@
{
"short_name": "Zdravo Stopalo",
"name": "Zdravo Stopalo",
"icons": [
{
"src": "<%= image_path('icon-192.png')%>",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "<%= image_path('icon-512.png')%>",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "<%= root_path %>",
"background_color": "#FFFFFF",
"display": "standalone",
"scope": "<%= root_path %>",
"theme_color": "#8e2731"
}

View File

@@ -0,0 +1,14 @@
function onInstall(event) {
console.log("[Serviceworker]", "Installing!", event);
}
function onActivate(event) {
console.log("[Serviceworker]", "Activating!", event);
}
function onFetch(event) {
console.log("[Serviceworker]", "Fetching!", event);
}
self.addEventListener("install", onInstall);
self.addEventListener("activate", onActivate);
self.addEventListener("fetch", onFetch);