mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Time edited doesn't show ns
This commit is contained in:
parent
0291c55181
commit
8554b5f535
13
routes.go
13
routes.go
@ -111,6 +111,10 @@ func editNote(c *gin.Context) {
|
|||||||
c.Redirect(302, "/"+title+"/view")
|
c.Redirect(302, "/"+title+"/view")
|
||||||
}
|
}
|
||||||
numRows := len(strings.Split(currentText, "\n")) + 10
|
numRows := len(strings.Split(currentText, "\n")) + 10
|
||||||
|
totalTimeString := totalTime.String()
|
||||||
|
if totalTime.Seconds() < 1 {
|
||||||
|
totalTimeString = "< 1 s"
|
||||||
|
}
|
||||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||||
"Title": title,
|
"Title": title,
|
||||||
"WikiName": RuntimeArgs.WikiName,
|
"WikiName": RuntimeArgs.WikiName,
|
||||||
@ -118,7 +122,7 @@ func editNote(c *gin.Context) {
|
|||||||
"CurrentText": currentText,
|
"CurrentText": currentText,
|
||||||
"NumRows": numRows,
|
"NumRows": numRows,
|
||||||
"Versions": versions,
|
"Versions": versions,
|
||||||
"TotalTime": totalTime,
|
"TotalTime": totalTimeString,
|
||||||
"SocketType": RuntimeArgs.Socket,
|
"SocketType": RuntimeArgs.Socket,
|
||||||
"NoEdit": !currentVersion,
|
"NoEdit": !currentVersion,
|
||||||
})
|
})
|
||||||
@ -194,13 +198,16 @@ func renderMarkdown(c *gin.Context, currentText string, title string, versions [
|
|||||||
html2 = strings.Replace(html2, "&#91;", "[", -1)
|
html2 = strings.Replace(html2, "&#91;", "[", -1)
|
||||||
html2 = strings.Replace(html2, "&#93;", "]", -1)
|
html2 = strings.Replace(html2, "&#93;", "]", -1)
|
||||||
html2 = strings.Replace(html2, "&35;", "#", -1)
|
html2 = strings.Replace(html2, "&35;", "#", -1)
|
||||||
|
totalTimeString := totalTime.String()
|
||||||
|
if totalTime.Seconds() < 1 {
|
||||||
|
totalTimeString = "< 1 s"
|
||||||
|
}
|
||||||
c.HTML(http.StatusOK, "view.tmpl", gin.H{
|
c.HTML(http.StatusOK, "view.tmpl", gin.H{
|
||||||
"Title": title,
|
"Title": title,
|
||||||
"WikiName": RuntimeArgs.WikiName,
|
"WikiName": RuntimeArgs.WikiName,
|
||||||
"Body": template.HTML([]byte(html2)),
|
"Body": template.HTML([]byte(html2)),
|
||||||
"Versions": versions,
|
"Versions": versions,
|
||||||
"TotalTime": totalTime.String(),
|
"TotalTime": totalTimeString,
|
||||||
"AdminKey": AdminKey,
|
"AdminKey": AdminKey,
|
||||||
"Encrypted": encrypted,
|
"Encrypted": encrypted,
|
||||||
"Prompt": noprompt,
|
"Prompt": noprompt,
|
||||||
|
Loading…
Reference in New Issue
Block a user