mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Merge pull request #311 from nuss-justin/issue/281
Fix #281. Add mouse-over precise time and on-click switch listener.
This commit is contained in:
		| @@ -12,6 +12,7 @@ import ( | ||||
| 	"encoding/hex" | ||||
| 	"fmt" | ||||
| 	"hash" | ||||
| 	"html/template" | ||||
| 	"math" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| @@ -241,8 +242,7 @@ func TimeSincePro(then time.Time) string { | ||||
| 	return strings.TrimPrefix(timeStr, ", ") | ||||
| } | ||||
|  | ||||
| // TimeSince calculates the time interval and generate user-friendly string. | ||||
| func TimeSince(then time.Time, lang string) string { | ||||
| func timeSince(then time.Time, lang string) string { | ||||
| 	now := time.Now() | ||||
|  | ||||
| 	lbl := i18n.Tr(lang, "tool.ago") | ||||
| @@ -292,6 +292,11 @@ func TimeSince(then time.Time, lang string) string { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // TimeSince calculates the time interval and generate user-friendly string. | ||||
| func TimeSince(t time.Time, lang string) template.HTML { | ||||
| 	return template.HTML(fmt.Sprintf(`<span class="time-since" title="%s">%s</span>`, t.Format(setting.TimeFormat), timeSince(t, lang))) | ||||
| } | ||||
|  | ||||
| const ( | ||||
| 	Byte  = 1 | ||||
| 	KByte = Byte * 1024 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user