diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 7e33f262094ee..6c911e72d5514 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -515,6 +515,7 @@ func NewTextFuncMap() []texttmpl.FuncMap { var widthRe = regexp.MustCompile(`width="[0-9]+?"`) var heightRe = regexp.MustCompile(`height="[0-9]+?"`) +var classRe = regexp.MustCompile(`class="(.*?)"`) func parseOthers(defaultSize int, defaultClass string, others ...interface{}) (int, string) { size := defaultSize @@ -555,7 +556,8 @@ func SVG(icon string, others ...interface{}) template.HTML { svgStr = heightRe.ReplaceAllString(svgStr, fmt.Sprintf(`height="%d"`, size)) } if class != "" { - svgStr = strings.Replace(svgStr, `class="`, fmt.Sprintf(`class="%s `, class), 1) + matches := classRe.FindStringSubmatch(svgStr) + svgStr = strings.Replace(svgStr, matches[0], fmt.Sprintf(`class="%s %s"`, matches[1], class), 1) } return template.HTML(svgStr) } diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 25cd68291ce75..9b20da128db50 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -70,8 +70,10 @@
{{.Name}}

- {{.NumMembers}} {{$.i18n.Tr "org.lower_members"}} · - {{.NumRepos}} {{$.i18n.Tr "org.lower_repositories"}} + {{- /* p */ -}} + {{.NumMembers}}{{$.i18n.Tr "org.lower_members"}}{{/* p */ -}} + ·{{/* p */ -}} + {{.NumRepos}}{{$.i18n.Tr "org.lower_repositories"}}{{/* p */ -}}

{{end}} diff --git a/templates/org/team/navbar.tmpl b/templates/org/team/navbar.tmpl index 18d638796c138..fe586984d62dd 100644 --- a/templates/org/team/navbar.tmpl +++ b/templates/org/team/navbar.tmpl @@ -1,4 +1,4 @@ diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 4e877bef2a1a4..41f15477da390 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -37,7 +37,12 @@ {{end}}
-

{{.NumMembers}} {{$.i18n.Tr "org.lower_members"}} · {{.NumRepos}} {{$.i18n.Tr "org.lower_repositories"}}

+

+ {{- .NumMembers}}{{/* p */ -}} + {{$.i18n.Tr "org.lower_members"}}{{/* p */ -}} + ·{{.NumRepos}}{{/* p */ -}} + {{$.i18n.Tr "org.lower_repositories"}}{{/* p */ -}} +

{{end}} diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index de4f0fb57e9e4..7f2721f4b8871 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -8,27 +8,34 @@ {{.i18n.Tr "repo.default_branch"}} -
- +
+
- - @@ -42,7 +49,7 @@ {{.i18n.Tr "repo.branches"}}
-
+ {{range .Branches}} {{if eq .Name $.DefaultBranch}} + {{$renderedCommitMessage := RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}} {{if .IsProtected}} {{svg "octicon-shield-lock"}} {{end}} {{$.DefaultBranch}} -

{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Commit.ID.String}} · {{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

+

+ {{- svg "octicon-git-commit" 16 "mr-2"}}{{/* p */ -}} + {{ShortSha .Commit.ID.String}}{{/* p */ -}} + ·{{$renderedCommitMessage}}{{/* p */ -}} + ·{{$.i18n.Tr "org.repo_updated"}}{{/* p */ -}} + {{TimeSince .Commit.Committer.When $.i18n.Lang}}{{/* p */ -}} +

{{end}} {{end}}
+
+
{{range .Branches}} {{if ne .Name $.DefaultBranch}} @@ -50,13 +57,23 @@
{{if .IsDeleted}} {{.Name}} -

{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}

+

+ {{- $.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}}{{/* p */ -}} + {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}{{/* p */ -}} +

{{else}} + {{$renderedCommitMessage := RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}} {{if .IsProtected}} {{svg "octicon-shield-lock"}} {{end}} {{.Name}} -

{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Commit.ID.String}} · {{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

+

+ {{- svg "octicon-git-commit" 16 "mr-2"}}{{/* p */ -}} + {{ShortSha .Commit.ID.String}}{{/* p */ -}} + ·{{$renderedCommitMessage}}{{/* p */ -}} + ·{{$.i18n.Tr "org.repo_updated"}}{{/* p */ -}} + {{TimeSince .Commit.Committer.When $.i18n.Lang}}{{/* p */ -}} +

{{end}}
@@ -106,8 +123,8 @@ {{end}} diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 6260d2e9652ba..8133fef5c389e 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -28,63 +28,56 @@
{{RenderCommitBody .Commit.Message $.RepoLink $.Repository.ComposeMetas}}
{{end}} {{if .BranchName}} - {{svg "octicon-git-branch"}}{{.BranchName}} + {{svg "octicon-git-branch" 16 "mr-2"}}{{.BranchName}} {{end}} {{if .TagName}} - {{svg "octicon-tag"}}{{.TagName}} + {{svg "octicon-tag" 16 "mr-2"}}{{.TagName}} {{end}} -
-
-
- {{if .Author}} - {{avatar .Author}} - {{if .Author.FullName}} - {{.Author.FullName}} - {{else}} - {{.Commit.Author.Name}} - {{end}} +
+
+ {{if .Author}} + {{avatar .Author}} + {{if .Author.FullName}} + {{.Author.FullName}} {{else}} - {{avatarByEmail .Commit.Author.Email .Commit.Author.Email 12}} - {{.Commit.Author.Name}} + {{.Commit.Author.Name}} {{end}} - {{TimeSince .Commit.Author.When $.Lang}} - {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} -
- {{svg "octicon-git-commit"}}{{.i18n.Tr "repo.diff.committed_by"}} - {{if ne .Verification.CommittingUser.ID 0}} - {{avatar .Verification.CommittingUser}} - {{.Commit.Committer.Name}} - {{else}} - {{avatarByEmail .Commit.Committer.Email .Commit.Committer.Name}} - {{.Commit.Committer.Name}} + {{else}} + {{avatarByEmail .Commit.Author.Email .Commit.Author.Email 12}} + {{.Commit.Author.Name}} + {{end}} + {{TimeSince .Commit.Author.When $.Lang}} + {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} +
+ {{svg "octicon-git-commit"}}{{.i18n.Tr "repo.diff.committed_by"}} + {{if ne .Verification.CommittingUser.ID 0}} + {{avatar .Verification.CommittingUser}} + {{.Commit.Committer.Name}} + {{else}} + {{avatarByEmail .Commit.Committer.Email .Commit.Committer.Name}} + {{.Commit.Committer.Name}} + {{end}} +
+ {{end}} +
+
+
+ {{- if .Parents -}} +
+ {{.i18n.Tr "repo.diff.parent"}} + {{range .Parents}} + {{$subpath := or (and $.PageIsWiki "/wiki/commit/") "/commit/" }} + {{ShortSha .}} {{end}}
- {{end}} - -
-
-
- {{if .Parents}} -
- {{.i18n.Tr "repo.diff.parent"}} -
-
- {{range .Parents}} - {{if $.PageIsWiki}} - {{ShortSha .}} - {{else}} - {{ShortSha .}} - {{end}} - {{end}} -
- {{end}} -
-
{{.i18n.Tr "repo.diff.commit"}}
-
{{ShortSha .CommitID}}
+ {{- end -}} +
+ {{.i18n.Tr "repo.diff.commit"}} + {{ShortSha .CommitID}}
-
-
+
+
{{if .Commit.Signature}}
diff --git a/templates/repo/commits.tmpl b/templates/repo/commits.tmpl index 5a8a89fe147c8..250edd915b869 100644 --- a/templates/repo/commits.tmpl +++ b/templates/repo/commits.tmpl @@ -3,7 +3,7 @@ {{template "repo/header" .}}
{{template "repo/sub_menu" .}} -