From e9f5e0cab55a8a92575139788ffb003ed5d4f576 Mon Sep 17 00:00:00 2001 From: r Date: Sun, 23 Feb 2020 13:26:39 +0000 Subject: [PATCH] Use element to set target --- renderer/model.go | 1 + service/service.go | 2 ++ templates/header.tmpl | 3 +++ templates/nav.tmpl | 16 ++++++++-------- templates/notification.tmpl | 12 ++++++------ templates/postform.tmpl | 2 +- templates/status.tmpl | 38 ++++++++++++++++++------------------- 7 files changed, 40 insertions(+), 34 deletions(-) diff --git a/renderer/model.go b/renderer/model.go index 45d3117..0d89af7 100644 --- a/renderer/model.go +++ b/renderer/model.go @@ -25,6 +25,7 @@ type CommonData struct { CustomCSS string CSRFToken string AutoRefresh bool + Target string } type ErrorData struct { diff --git a/service/service.go b/service/service.go index 9e01509..4316f86 100644 --- a/service/service.go +++ b/service/service.go @@ -189,6 +189,7 @@ func (svc *service) ServeNavPage(ctx context.Context, c *model.Client) (err erro } commonData := svc.getCommonData(ctx, c, "Nav") + commonData.Target = "main" data := &renderer.NavData{ User: u, CommonData: commonData, @@ -422,6 +423,7 @@ func (svc *service) ServeNotificationPage(ctx context.Context, c *model.Client, commonData := svc.getCommonData(ctx, c, "notifications") commonData.AutoRefresh = c.Session.Settings.AutoRefreshNotifications + commonData.Target = "main" data := &renderer.NotificationData{ Notifications: notifications, UnreadCount: unreadCount, diff --git a/templates/header.tmpl b/templates/header.tmpl index 76831f2..ca2986d 100644 --- a/templates/header.tmpl +++ b/templates/header.tmpl @@ -4,6 +4,9 @@ + {{if .Target}} + + {{end}} {{if .CSRFToken}} {{end}} diff --git a/templates/nav.tmpl b/templates/nav.tmpl index 620643e..8922ba7 100644 --- a/templates/nav.tmpl +++ b/templates/nav.tmpl @@ -2,24 +2,24 @@ {{template "header.tmpl" (WithContext .CommonData $.Ctx)}}