templates/repo/branches: hide pull request button if not allowed (#4377)

master
Unknwon 2017-04-03 22:24:21 -04:00
parent 1bc805bb4b
commit b873ec2bce
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
5 changed files with 5 additions and 4 deletions

View File

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

View File

@ -61,6 +61,7 @@ func loadBranches(ctx *context.Context) []*Branch {
}
}
ctx.Data["AllowPullRequest"] = ctx.Repo.Repository.AllowsPulls()
return branches
}

View File

@ -1 +1 @@
0.11.0.0403
0.11.1.0403

View File

@ -19,7 +19,7 @@
<div class="ui four wide column">
{{if and (eq $.BranchName .Name) $.IsRepositoryWriter}}
<a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{$.i18n.Tr "repo.branches.change_default_branch"}}</a>
{{else if $.IsRepositoryAdmin}}
{{else if and $.IsRepositoryWriter $.AllowPullRequest}}
<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>
{{end}}
</div>

View File

@ -35,7 +35,7 @@
{{$timeSince := TimeSince .Commit.Committer.When $.Lang}}
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
</div>
{{if $.IsRepositoryWriter}}
{{if and $.IsRepositoryWriter $.AllowPullRequest}}
<div class="ui four wide column">
<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>
</div>