Skip to content

Commit

Permalink
allow html in notification on old start page
Browse files Browse the repository at this point in the history
  • Loading branch information
joschahenningsen committed Jul 26, 2023
1 parent 9e7682e commit 2d04b7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions model/server-notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package model
import (
"errors"
"gorm.io/gorm"
"html/template"
"time"
)

Expand Down Expand Up @@ -30,3 +31,7 @@ func (s ServerNotification) FormatFrom() string {
func (s ServerNotification) FormatExpires() string {
return s.Expires.Format("2006-01-02 15:04")
}

func (s ServerNotification) HTML() template.HTML {
return template.HTML(s.Text)
}
2 changes: 1 addition & 1 deletion web/template/index.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{{if .ServerNotifications}}
{{range $notification := .ServerNotifications}}
<p class="{{if $notification.Warn}} text-red-400{{else}} text-yellow-400{{end}}"><i
class="fas fa-exclamation-triangle mr-2"></i><span>{{$notification.Text}}</span></p>
class="fas fa-exclamation-triangle mr-2"></i><span>{{$notification.HTML}}</span></p>
{{end}}
{{end}}
{{if not .TUMLiveContext.User}}
Expand Down

0 comments on commit 2d04b7c

Please sign in to comment.