mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-29 06:49:05 +08:00
Improve readability and styling of last refresh timestamp. Closes #190
This commit is contained in:
5
assets/goreportcard.css
vendored
5
assets/goreportcard.css
vendored
@@ -1,3 +1,8 @@
|
||||
time {
|
||||
border-bottom: 1px dashed;
|
||||
line-height: 1.5em;
|
||||
cursor: pointer;
|
||||
}
|
||||
.header .is-active {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ func getFromCache(repo string) (checksResp, error) {
|
||||
}
|
||||
|
||||
resp.LastRefresh = resp.LastRefresh.UTC()
|
||||
resp.HumanizedLastRefresh = humanize.Time(resp.LastRefresh.UTC())
|
||||
resp.LastRefreshFormatted = resp.LastRefresh.Format(time.UnixDate)
|
||||
resp.LastRefreshHumanized = humanize.Time(resp.LastRefresh.UTC())
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -72,7 +73,8 @@ type checksResp struct {
|
||||
Repo string `json:"repo"`
|
||||
ResolvedRepo string `json:"resolvedRepo"`
|
||||
LastRefresh time.Time `json:"last_refresh"`
|
||||
HumanizedLastRefresh string `json:"humanized_last_refresh"`
|
||||
LastRefreshFormatted string `json:"formatted_last_refresh"`
|
||||
LastRefreshHumanized string `json:"humanized_last_refresh"`
|
||||
}
|
||||
|
||||
func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
|
||||
@@ -142,12 +144,14 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
|
||||
}(c)
|
||||
}
|
||||
|
||||
t := time.Now().UTC()
|
||||
resp := checksResp{
|
||||
Repo: repo,
|
||||
ResolvedRepo: repoRoot.Repo,
|
||||
Files: len(filenames),
|
||||
LastRefresh: time.Now().UTC(),
|
||||
HumanizedLastRefresh: humanize.Time(time.Now().UTC()),
|
||||
LastRefresh: t,
|
||||
LastRefreshFormatted: t.Format(time.UnixDate),
|
||||
LastRefreshHumanized: humanize.Time(t),
|
||||
}
|
||||
|
||||
var total, totalWeight float64
|
||||
|
||||
@@ -159,7 +159,10 @@
|
||||
<hr>
|
||||
</script>
|
||||
<script id="template-lastrefresh" type="text/x-handlebars-template">
|
||||
<p>Last refresh: <span title={{last_refresh}}>{{humanized_last_refresh}}</span></p>
|
||||
<div title="{{formatted_last_refresh}}">
|
||||
Last refresh:
|
||||
<time datetime="{{last_refresh}}" class="label-align">{{humanized_last_refresh}}</time>
|
||||
</div>
|
||||
<br>
|
||||
<p><a class="refresh-button button" href=""><strong>Refresh now</strong></a></p>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user