diff options
Diffstat (limited to 'templates/repo/home.tmpl')
-rw-r--r-- | templates/repo/home.tmpl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index e2e6b2be63..3359bd7ef0 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -57,17 +57,21 @@ {{end}} {{template "repo/sub_menu" .}} <div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins"> - {{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}} - <div class="fitted item"> - <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}"> - <button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button> - </a> - </div> - {{end}} {{template "repo/branch_dropdown" .}} {{ $n := len .TreeNames}} {{ $l := Subtract $n 1}} - <div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div> + <!-- If home page, show new PR. If not, show breadcrumb --> + {{if eq $n 0}} + {{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}} + <div class="fitted item"> + <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}"> + <button id="new-pull-request" class="ui compact basic button">{{.i18n.Tr "repo.pulls.compare_changes"}}</button> + </a> + </div> + {{end}} + {{else}} + <div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div> + {{end}} <div class="right fitted item" id="file-buttons"> <div class="ui tiny blue buttons"> {{if .Repository.CanEnableEditor}} |