Browse Source

templates/repo/branches: escape pound in branch name (#4874)

pull/5126/head
Unknwon 7 years ago
parent
commit
ba0a78da2a
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      gogs.go
  2. 2
      templates/.VERSION
  3. 2
      templates/repo/branches/all.tmpl
  4. 10
      templates/repo/branches/overview.tmpl

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/setting"
) )
const APP_VER = "0.11.37.0312" const APP_VER = "0.11.38.0312"
func init() { func init() {
setting.AppVer = APP_VER setting.AppVer = APP_VER

2
templates/.VERSION

@ -1 +1 @@
0.11.37.0312 0.11.38.0312

2
templates/repo/branches/all.tmpl

@ -20,7 +20,7 @@
{{if and (and (eq $.BranchName .Name) $.IsRepositoryAdmin) (not $.Repository.IsMirror)}} {{if and (and (eq $.BranchName .Name) $.IsRepositoryAdmin) (not $.Repository.IsMirror)}}
<a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{$.i18n.Tr "repo.branches.change_default_branch"}}</a> <a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{$.i18n.Tr "repo.branches.change_default_branch"}}</a>
{{else if and $.IsRepositoryWriter $.AllowPullRequest}} {{else if and $.IsRepositoryWriter $.AllowPullRequest}}
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.BranchName}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a> <a class="ui basic button" href="{{$.RepoLink}}/compare/{{EscapePound $.BranchName}}...{{EscapePound .Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
{{end}} {{end}}
</div> </div>
</div> </div>

10
templates/repo/branches/overview.tmpl

@ -11,7 +11,7 @@
<div class="ui attached segment list"> <div class="ui attached segment list">
<div class="item ui grid"> <div class="item ui grid">
<div class="ui eleven wide column"> <div class="ui eleven wide column">
{{if .DefaultBranch.IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{.DefaultBranch.Name}}"><code>{{.DefaultBranch.Name}}</code></a> {{if .DefaultBranch.IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{EscapePound .DefaultBranch.Name}}"><code>{{.DefaultBranch.Name}}</code></a>
{{$timeSince := TimeSince .DefaultBranch.Commit.Committer.When $.Lang}} {{$timeSince := TimeSince .DefaultBranch.Commit.Committer.When $.Lang}}
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .DefaultBranch.Commit.Committer.Name | Safe}}</span> <span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .DefaultBranch.Commit.Committer.Name | Safe}}</span>
</div> </div>
@ -31,13 +31,13 @@
{{range .ActiveBranches}} {{range .ActiveBranches}}
<div class="item ui grid"> <div class="item ui grid">
<div class="ui eleven wide column"> <div class="ui eleven wide column">
{{if .IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{.Name}}"><code>{{.Name}}</code></a> {{if .IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{EscapePound .Name}}"><code>{{.Name}}</code></a>
{{$timeSince := TimeSince .Commit.Committer.When $.Lang}} {{$timeSince := TimeSince .Commit.Committer.When $.Lang}}
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span> <span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
</div> </div>
{{if and $.IsRepositoryWriter $.AllowPullRequest}} {{if and $.IsRepositoryWriter $.AllowPullRequest}}
<div class="ui four wide column"> <div class="ui four wide column">
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.BranchName}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a> <a class="ui basic button" href="{{$.RepoLink}}/compare/{{EscapePound $.BranchName}}...{{EscapePound .Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
</div> </div>
{{end}} {{end}}
</div> </div>
@ -53,13 +53,13 @@
{{range .StaleBranches}} {{range .StaleBranches}}
<div class="item ui grid"> <div class="item ui grid">
<div class="ui eleven wide column"> <div class="ui eleven wide column">
{{if .IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{.Name}}"><code>{{.Name}}</code></a> {{if .IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{EscapePound .Name}}"><code>{{.Name}}</code></a>
{{$timeSince := TimeSince .Commit.Committer.When $.Lang}} {{$timeSince := TimeSince .Commit.Committer.When $.Lang}}
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span> <span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
</div> </div>
{{if and $.IsRepositoryWriter $.AllowPullRequest}} {{if and $.IsRepositoryWriter $.AllowPullRequest}}
<div class="ui four wide column"> <div class="ui four wide column">
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.BranchName}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a> <a class="ui basic button" href="{{$.RepoLink}}/compare/{{EscapePound $.BranchName}}...{{EscapePound .Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
</div> </div>
{{end}} {{end}}
</div> </div>

Loading…
Cancel
Save