mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-07 11:35:51 +00:00
Add flash message when digest has been emailed.
This commit is contained in:
parent
45364c385a
commit
f0b15e7324
3 changed files with 28 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
{{define "body"}}
|
||||
|
||||
{{range .Flashes}}
|
||||
{{template "flash" .}}
|
||||
{{end}}
|
||||
|
||||
<p>
|
||||
Signed in as
|
||||
<a href="https://github.com/{{.User.Login}}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue