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 @@
- {{.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 */ -}}
+ |
{{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}} · · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}} ++ {{- svg "octicon-git-commit" 16 "mr-2"}}{{/* p */ -}} + {{ShortSha .Commit.ID.String}}{{/* p */ -}} + · {{/* p */ -}} + ·{{$.i18n.Tr "org.repo_updated"}}{{/* p */ -}} + {{TimeSince .Commit.Committer.When $.i18n.Lang}}{{/* p */ -}} + {{end}} {{end}} |
- + | @@ -42,7 +49,7 @@ {{.i18n.Tr "repo.branches"}} |
{{if .IsDeleted}}
{{$.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}} · · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}} ++ {{- svg "octicon-git-commit" 16 "mr-2"}}{{/* p */ -}} + {{ShortSha .Commit.ID.String}}{{/* p */ -}} + · {{/* p */ -}} + ·{{$.i18n.Tr "org.repo_updated"}}{{/* p */ -}} + {{TimeSince .Commit.Committer.When $.i18n.Lang}}{{/* p */ -}} + {{end}} |
@@ -106,8 +123,8 @@
{{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 .Commit.Signature}}
|
{{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 @@