diff --git a/app/githop.go b/app/githop.go index 979d588..6bd1a2c 100644 --- a/app/githop.go +++ b/app/githop.go @@ -229,10 +229,15 @@ func indexHandler(w http.ResponseWriter, r *http.Request) { "RepositoryCount": repositoryCount, "EmailAddress": emailAddress, } + flashes := session.Flashes() + if len(flashes) > 0 { + session.Save(r, w) + } var data = map[string]interface{}{ "User": user, "SettingsSummary": settingsSummary, "DetectTimezone": !account.HasTimezoneSet, + "Flashes": flashes, } if err := templates["index"].Execute(w, data); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -281,6 +286,8 @@ func sendDigestHandler(w http.ResponseWriter, r *http.Request) { return } + session.AddFlash("Digest emailed!") + session.Save(r, w) indexUrl, _ := router.Get("index").URL() http.Redirect(w, r, indexUrl.String(), http.StatusFound) } diff --git a/app/static/main.css b/app/static/main.css index 89f03c4..b00da75 100644 --- a/app/static/main.css +++ b/app/static/main.css @@ -85,3 +85,20 @@ input[type="submit"].destructive { text-decoration: underline; color: #900; } + +.flash { + position: absolute; + top: 20px; + right: 20px; + background: rgba(0, 0, 0, 0.75); + border-radius: 4px; + color: #fff; + font-size: 12pt; + padding: 10px; + transition: opacity ease-in-out 300ms; + opacity: 0; +} + +.flash.visible { + opacity: 1; +} diff --git a/app/templates/index.html b/app/templates/index.html index fb73e8b..392c1dd 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -2,6 +2,10 @@ {{define "body"}} +{{range .Flashes}} + {{template "flash" .}} +{{end}} +

Signed in as