mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-27 15:07:43 +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,
|
"RepositoryCount": repositoryCount,
|
||||||
"EmailAddress": emailAddress,
|
"EmailAddress": emailAddress,
|
||||||
}
|
}
|
||||||
|
flashes := session.Flashes()
|
||||||
|
if len(flashes) > 0 {
|
||||||
|
session.Save(r, w)
|
||||||
|
}
|
||||||
var data = map[string]interface{}{
|
var data = map[string]interface{}{
|
||||||
"User": user,
|
"User": user,
|
||||||
"SettingsSummary": settingsSummary,
|
"SettingsSummary": settingsSummary,
|
||||||
"DetectTimezone": !account.HasTimezoneSet,
|
"DetectTimezone": !account.HasTimezoneSet,
|
||||||
|
"Flashes": flashes,
|
||||||
}
|
}
|
||||||
if err := templates["index"].Execute(w, data); err != nil {
|
if err := templates["index"].Execute(w, data); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
|
@ -281,6 +286,8 @@ func sendDigestHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.AddFlash("Digest emailed!")
|
||||||
|
session.Save(r, w)
|
||||||
indexUrl, _ := router.Get("index").URL()
|
indexUrl, _ := router.Get("index").URL()
|
||||||
http.Redirect(w, r, indexUrl.String(), http.StatusFound)
|
http.Redirect(w, r, indexUrl.String(), http.StatusFound)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,3 +85,20 @@ input[type="submit"].destructive {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
color: #900;
|
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"}}
|
{{define "body"}}
|
||||||
|
|
||||||
|
{{range .Flashes}}
|
||||||
|
{{template "flash" .}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Signed in as
|
Signed in as
|
||||||
<a href="https://github.com/{{.User.Login}}"
|
<a href="https://github.com/{{.User.Login}}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue