Browse Source

Use singular forms in repo stats if appropriate

Lucas Stadler 8 years ago
parent
commit
cd07c039ef
1 changed files with 11 additions and 4 deletions
  1. 11 4
      quit.go

+ 11 - 4
quit.go

564
}
564
}
565
565
566
var repoFuncs = template.FuncMap{
566
var repoFuncs = template.FuncMap{
567
	"count": func(count int, singular, plural string) template.HTML {
568
		form := plural
569
		if count == 1 {
570
			form = singular
571
		}
572
		return template.HTML(fmt.Sprintf("<span class=\"count\">%d</span> %s", count, form))
573
	},
567
	"languageToColor": func(l string) string {
574
	"languageToColor": func(l string) string {
568
		c, ok := languageColors[l]
575
		c, ok := languageColors[l]
569
		if !ok {
576
		if !ok {
586
		<div id="container">
593
		<div id="container">
587
594
588
		<section id="repo" class="repo-info">
595
		<section id="repo" class="repo-info">
589
			<a id="commits" class="repo-stat" href="#"><span class="icon">⏲</span><span class="count">{{ .Repo.CommitCount }}</span> commits</a>
590
			<a id="branches" class="repo-stat" href="#"><span class="icon">⛗</span><span class="count">{{ len .Repo.Branches }}</span> branches</a>
591
			<a id="tags" class="repo-stat" href="#"><span class="icon">🏷&#xFE0E;</span><span class="count">{{ len .Repo.Tags }}</span> tags</a>
592
			<a id="contributors" class="repo-stat" href="#"><span class="icon">👥</span><span class="count">{{ len .Repo.Contributors }}</span> contributors</a>
596
			<a id="commits" class="repo-stat" href="#"><span class="icon">⏲</span>{{ count .Repo.CommitCount "commit" "commits" }}</a>
597
			<a id="branches" class="repo-stat" href="#"><span class="icon">⛗</span>{{ count (len .Repo.Branches) "branch" "branches" }}</a>
598
			<a id="tags" class="repo-stat" href="#"><span class="icon">🏷&#xFE0E;</span>{{ count (len .Repo.Tags) "tag" "tags" }}</a>
599
			<a id="contributors" class="repo-stat" href="#"><span class="icon">👥</span>{{ count (len .Repo.Contributors) "contributor" "contributors" }}</a>
593
		</section>
600
		</section>
594
601
595
		<div id="languages">
602
		<div id="languages">