aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/head_tags.php1
-rw-r--r--templates/notification.php11
-rw-r--r--templates/notifications_panel.php3
3 files changed, 14 insertions, 1 deletions
diff --git a/templates/head_tags.php b/templates/head_tags.php
index 88ac6ff..47fcef0 100644
--- a/templates/head_tags.php
+++ b/templates/head_tags.php
@@ -1,6 +1,7 @@
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="https://fonts.bunny.net/css?family=dm-sans:400,400i,800,800i">
<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="theme-color" content="#3b005e">
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
<script src="https://unpkg.com/hyperscript.org@0.9.13"></script>
<script src="/static/language-switch.js" defer></script> \ No newline at end of file
diff --git a/templates/notification.php b/templates/notification.php
index a010ff9..a23a3a6 100644
--- a/templates/notification.php
+++ b/templates/notification.php
@@ -20,4 +20,15 @@
<?php endif; ?>
<span class="body"><?= htmlspecialchars($body) ?></span>
</div>
+ <div hidden class="notifier" <?php if ($unread): ?> _="
+ on load
+ set title to innerText of previous .title
+ set body to innerText of previous .body
+ set icon to @src of previous <img/>
+ set titleLink to previous <a/>
+ js(title, body, icon, titleLink)
+ let n = new Notification(title, { body: body, icon: icon })
+ n.addEventListener('click', () => titleLink.click())
+ end
+ " <?php endif; ?>></div>
</div> \ No newline at end of file
diff --git a/templates/notifications_panel.php b/templates/notifications_panel.php
index 98a04e3..574a295 100644
--- a/templates/notifications_panel.php
+++ b/templates/notifications_panel.php
@@ -3,7 +3,8 @@ use Digitigrade\Model\Notification;
$notifications = Notification::findAllForUser($user, 50);
?>
-<div id="notificationsPanel">
+<div id="notificationsPanel"
+ _="on load js if (Notification.permission == 'default') Notification.requestPermission() end">
<h2><?= __('notifications.heading') ?></h2>
<?php call_template('live_notifications_updater', ['since' => new \DateTimeImmutable()]); ?>
<div class="items">