diff options
Diffstat (limited to 'templates/repo')
-rw-r--r-- | templates/repo/branch/list.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/diff/compare.tmpl | 36 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 4 |
3 files changed, 23 insertions, 21 deletions
diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index b310edfbd3..d2eedef49c 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -81,13 +81,13 @@ </a> {{else if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} <a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}"> - <button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button> + <button id="new-pull-request" class="ui compact basic button">{{if $.CanPull}}{{$.i18n.Tr "repo.pulls.compare_changes"}}{{else}}{{$.i18n.Tr "action.compare_branch"}}{{end}}</button> </a> {{end}} {{else if and .LatestPullRequest.HasMerged .MergeMovedOn}} {{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} <a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}"> - <button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button> + <button id="new-pull-request" class="ui compact basic button">{{if $.CanPull}}{{$.i18n.Tr "repo.pulls.compare_changes"}}{{else}}{{$.i18n.Tr "action.compare_branch"}}{{end}}</button> </a> {{end}} {{else}} diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index b088636434..35a37ab761 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -5,7 +5,7 @@ {{if .PageIsComparePull}} <h2 class="ui header"> - {{if not .Repository.IsArchived}} + {{if and $.IsSigned (not .Repository.IsArchived)}} {{.i18n.Tr "repo.pulls.compare_changes"}} <div class="sub header">{{.i18n.Tr "repo.pulls.compare_changes_desc"}}</div> {{ else }} @@ -64,22 +64,24 @@ <div class="ui segment"> {{.i18n.Tr "repo.pulls.has_pull_request" $.RepoLink $.RepoRelPath .PullRequest.Index | Safe}} </div> - {{else}} - {{if not .Repository.IsArchived}} - <div class="ui info message show-form-container"> - <button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button> - </div> - {{ else }} - <div class="ui warning message"> - {{.i18n.Tr "repo.archive.title"}} - </div> - {{ end }} - <div class="pullrequest-form" style="display: none"> - {{template "repo/issue/new_form" .}} - </div> - {{template "repo/commits_table" .}} - {{template "repo/diff/box" .}} - {{end}} + {{else}} + {{if and $.IsSigned (not .Repository.IsArchived)}} + <div class="ui info message show-form-container"> + <button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button> + </div> + {{else if .Repository.IsArchived}} + <div class="ui warning message"> + {{.i18n.Tr "repo.archive.title"}} + </div> + {{end}} + {{if $.IsSigned}} + <div class="pullrequest-form" style="display: none"> + {{template "repo/issue/new_form" .}} + </div> + {{end}} + {{template "repo/commits_table" .}} + {{template "repo/diff/box" .}} + {{end}} {{else}} {{template "repo/commits_table" .}} {{template "repo/diff/box" .}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 51e924747c..3a0d364f34 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -62,10 +62,10 @@ {{ $l := Subtract $n 1}} <!-- If home page, show new PR. If not, show breadcrumb --> {{if eq $n 0}} - {{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}} + {{if and .CanCompareOrPull .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> + <button id="new-pull-request" class="ui compact basic button">{{if .PullRequestCtx.Allowed}}{{.i18n.Tr "repo.pulls.compare_changes"}}{{else}}{{.i18n.Tr "action.compare_branch"}}{{end}}</button> </a> </div> {{end}} |