Skip to content

Commit 6244743

Browse files
committed
templates/repo/branches: fix links for mirror repository
Also added new pull request button for stale branches.
1 parent e0a787b commit 6244743

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

templates/repo/branches/all.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
1818
</div>
1919
<div class="ui four wide column">
20-
{{if and (eq $.BranchName .Name) $.IsRepositoryWriter}}
20+
{{if and (and (eq $.BranchName .Name) $.IsRepositoryAdmin) (not $.Repository.IsMirror)}}
2121
<a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{$.i18n.Tr "repo.branches.change_default_branch"}}</a>
2222
{{else if and $.IsRepositoryWriter $.AllowPullRequest}}
23-
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.DefaultBranch.Name}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
23+
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.BranchName}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
2424
{{end}}
2525
</div>
2626
</div>

templates/repo/branches/overview.tmpl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{{$timeSince := TimeSince .DefaultBranch.Commit.Committer.When $.Lang}}
1616
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .DefaultBranch.Commit.Committer.Name | Safe}}</span>
1717
</div>
18-
{{if $.IsRepositoryAdmin}}
18+
{{if and $.IsRepositoryAdmin (not $.Repository.IsMirror)}}
1919
<div class="ui four wide column">
2020
<a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{.i18n.Tr "repo.branches.change_default_branch"}}</a>
2121
</div>
@@ -37,7 +37,7 @@
3737
</div>
3838
{{if and $.IsRepositoryWriter $.AllowPullRequest}}
3939
<div class="ui four wide column">
40-
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.DefaultBranch.Name}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
40+
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.BranchName}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
4141
</div>
4242
{{end}}
4343
</div>
@@ -52,11 +52,16 @@
5252
<div class="ui attached segment list">
5353
{{range .StaleBranches}}
5454
<div class="item ui grid">
55-
<div class="ui fourteen wide column">
55+
<div class="ui eleven wide column">
5656
{{if .IsProtected}}<i class="octicon octicon-shield"></i> {{end}}<a class="markdown" href="{{$.RepoLink}}/src/{{.Name}}"><code>{{.Name}}</code></a>
5757
{{$timeSince := TimeSince .Commit.Committer.When $.Lang}}
5858
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
5959
</div>
60+
{{if and $.IsRepositoryWriter $.AllowPullRequest}}
61+
<div class="ui four wide column">
62+
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.BranchName}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
63+
</div>
64+
{{end}}
6065
</div>
6166
{{end}}
6267
</div>

0 commit comments

Comments
 (0)