hover all timestamp displays to get more detail

This commit is contained in:
mappu 2017-11-18 15:30:29 +13:00
parent cfc0107bef
commit 51aae382b7
3 changed files with 7 additions and 4 deletions

View File

@ -47,9 +47,11 @@ func (this *WikiServer) servePageResponse(w http.ResponseWriter, r *http.Request
} }
} }
func (this *WikiServer) formatTimestamp(m int64) string { func (this *WikiServer) formatTimestamp(m int64) template.HTML {
// TODO add a more detailed timestamp on hover // TODO add a more detailed timestamp on hover
return template.HTMLEscapeString(time.Unix(m, 0).In(this.loc).Format(this.opts.DateFormat)) dt := time.Unix(m, 0).In(this.loc)
return template.HTML(`<span title="` + template.HTMLEscapeString(dt.Format(time.RFC3339)) + `">` + template.HTMLEscapeString(dt.Format(this.opts.DateFormat)) + `</span>`)
} }
func (this *WikiServer) viewLink(articleTitle string) template.HTML { func (this *WikiServer) viewLink(articleTitle string) template.HTML {

View File

@ -39,7 +39,7 @@ func (this *WikiServer) routeHistory(w http.ResponseWriter, r *http.Request, art
for _, rev := range revs { for _, rev := range revs {
revIdStr := fmt.Sprintf("%d", rev.ID) revIdStr := fmt.Sprintf("%d", rev.ID)
content += `<tr>` + content += `<tr>` +
`<td><a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`archive/`+revIdStr) + `">` + this.formatTimestamp(rev.Modified) + `</a></td>` + `<td><a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`archive/`+revIdStr) + `">` + string(this.formatTimestamp(rev.Modified)) + `</a></td>` +
`<td>` + template.HTMLEscapeString(rev.Author) + `</td>` + `<td>` + template.HTMLEscapeString(rev.Author) + `</td>` +
`<td><input type="radio" name="t" value="` + revIdStr + `">&nbsp;<input type="radio" name="f" value="` + revIdStr + `"></td>` + `<td><input type="radio" name="t" value="` + revIdStr + `">&nbsp;<input type="radio" name="f" value="` + revIdStr + `"></td>` +
`</tr>` `</tr>`

View File

@ -44,7 +44,8 @@ func (this *WikiServer) routeRecentChanges(w http.ResponseWriter, r *http.Reques
`<td><a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`view/`+url.PathEscape(rev.Title)) + `">` + template.HTMLEscapeString(rev.Title) + `</a>` + `<td><a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`view/`+url.PathEscape(rev.Title)) + `">` + template.HTMLEscapeString(rev.Title) + `</a>` +
` [<a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`archive/`+fmt.Sprintf("%d", rev.ID)) + `">a</a>]` + ` [<a href="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`archive/`+fmt.Sprintf("%d", rev.ID)) + `">a</a>]` +
`</td>` + `</td>` +
`<td>` + this.formatTimestamp(rev.Modified) + ` by ` + template.HTMLEscapeString(rev.Author) + `</td>` + `<td>` + string(this.formatTimestamp(rev.Modified)) + `</td>` +
`<td>` + template.HTMLEscapeString(rev.Author) + `</td>` +
`</tr>` `</tr>`
} }
content += `<tr><td>` content += `<tr><td>`