summaryrefslogtreecommitdiffstats
path: root/templates/base
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-04-24 04:57:38 +0100
committerGitHub <noreply@github.com>2020-04-24 00:57:38 -0300
commitb10c416f9e72da39fb5f7398c7c67faaab008a5e (patch)
treedd5579c788f0a29326f979c9a984cd899b2f1737 /templates/base
parente74c4e1be988f2815146338cbce8210e515a937e (diff)
downloadgitea-b10c416f9e72da39fb5f7398c7c67faaab008a5e.tar.gz
gitea-b10c416f9e72da39fb5f7398c7c67faaab008a5e.zip
Use AJAX for notifications table (#10961)
* Use AJAX for notifications table Signed-off-by: Andrew Thornton <art27@cantab.net> * move to separate js Signed-off-by: Andrew Thornton <art27@cantab.net> * placate golangci-lint Signed-off-by: Andrew Thornton <art27@cantab.net> * Add autoupdating notification count Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix wipeall Signed-off-by: Andrew Thornton <art27@cantab.net> * placate tests Signed-off-by: Andrew Thornton <art27@cantab.net> * Try hidden Signed-off-by: Andrew Thornton <art27@cantab.net> * Try hide and hidden Signed-off-by: Andrew Thornton <art27@cantab.net> * More auto-update improvements Only run checker on pages that have a count Change starting checker to 10s with a back-off to 60s if there is no change Signed-off-by: Andrew Thornton <art27@cantab.net> * string comparison! Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @silverwind Signed-off-by: Andrew Thornton <art27@cantab.net> * add configurability as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add documentation as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Use CSRF header not query Signed-off-by: Andrew Thornton <art27@cantab.net> * Further JS improvements Fix @etzelia update notification table request Fix @silverwind comments Co-Authored-By: silverwind <me@silverwind.io> Signed-off-by: Andrew Thornton <art27@cantab.net> * Simplify the notification count fns Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'templates/base')
-rw-r--r--templates/base/head.tmpl5
-rw-r--r--templates/base/head_navbar.tmpl11
2 files changed, 10 insertions, 6 deletions
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index e0765d59d3..2d7d737a00 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -94,6 +94,11 @@
U2F: {{if .RequireU2F}}true{{else}}false{{end}},
Heatmap: {{if .EnableHeatmap}}true{{else}}false{{end}},
heatmapUser: {{if .HeatmapUser}}'{{.HeatmapUser}}'{{else}}null{{end}},
+ NotificationSettings: {
+ MinTimeout: {{NotificationSettings.MinTimeout}},
+ TimeoutStep: {{NotificationSettings.TimeoutStep}},
+ MaxTimeout: {{NotificationSettings.MaxTimeout}},
+ },
};
</script>
<link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png">
diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl
index de02bca1f7..cedf29e2e9 100644
--- a/templates/base/head_navbar.tmpl
+++ b/templates/base/head_navbar.tmpl
@@ -46,12 +46,11 @@
<span class="text">
<span class="fitted">{{svg "octicon-bell" 16}}</span>
<span class="sr-mobile-only">{{.i18n.Tr "notifications"}}</span>
-
- {{if .NotificationUnreadCount}}
- <span class="ui red label">
- {{.NotificationUnreadCount}}
- </span>
- {{end}}
+ {{$notificationUnreadCount := 0}}
+ {{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}}
+ <span class="ui red label {{if not $notificationUnreadCount}}hidden{{end}} notification_count">
+ {{$notificationUnreadCount}}
+ </span>
</span>
</a>