This commit is contained in:
parent
de1e4b2da9
commit
2791cc139e
2 changed files with 36 additions and 16 deletions
|
@ -113,6 +113,24 @@ func (cfg *PullRequestsConfig) IsMergeStyleAllowed(mergeStyle MergeStyle) bool {
|
||||||
mergeStyle == MergeStyleSquash && cfg.AllowSquash
|
mergeStyle == MergeStyleSquash && cfg.AllowSquash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AllowedMergeStyleCount returns the total count of allowed merge styles for the PullRequestsConfig
|
||||||
|
func (cfg *PullRequestsConfig) AllowedMergeStyleCount() int {
|
||||||
|
count := 0
|
||||||
|
if cfg.AllowMerge {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
if cfg.AllowRebase {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
if cfg.AllowRebaseMerge {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
if cfg.AllowSquash {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
// BeforeSet is invoked from XORM before setting the value of a field of this object.
|
// BeforeSet is invoked from XORM before setting the value of a field of this object.
|
||||||
func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) {
|
func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) {
|
||||||
switch colName {
|
switch colName {
|
||||||
|
|
|
@ -335,23 +335,25 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="ui dropdown icon button">
|
{{if gt $prUnit.PullRequestsConfig.AllowedMergeStyleCount 1}}
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
<div class="ui dropdown icon button">
|
||||||
<div class="menu">
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
{{if $prUnit.PullRequestsConfig.AllowMerge}}
|
<div class="menu">
|
||||||
<div class="item{{if eq .MergeStyle "merge"}} active selected{{end}}" data-do="merge">{{$.i18n.Tr "repo.pulls.merge_pull_request"}}</div>
|
{{if $prUnit.PullRequestsConfig.AllowMerge}}
|
||||||
{{end}}
|
<div class="item{{if eq .MergeStyle "merge"}} active selected{{end}}" data-do="merge">{{$.i18n.Tr "repo.pulls.merge_pull_request"}}</div>
|
||||||
{{if $prUnit.PullRequestsConfig.AllowRebase}}
|
{{end}}
|
||||||
<div class="item{{if eq .MergeStyle "rebase"}} active selected{{end}}" data-do="rebase">{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
|
{{if $prUnit.PullRequestsConfig.AllowRebase}}
|
||||||
{{end}}
|
<div class="item{{if eq .MergeStyle "rebase"}} active selected{{end}}" data-do="rebase">{{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
|
||||||
{{if $prUnit.PullRequestsConfig.AllowRebaseMerge}}
|
{{end}}
|
||||||
<div class="item{{if eq .MergeStyle "rebase-merge"}} active selected{{end}}" data-do="rebase-merge">{{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
|
{{if $prUnit.PullRequestsConfig.AllowRebaseMerge}}
|
||||||
{{end}}
|
<div class="item{{if eq .MergeStyle "rebase-merge"}} active selected{{end}}" data-do="rebase-merge">{{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
|
||||||
{{if $prUnit.PullRequestsConfig.AllowSquash}}
|
{{end}}
|
||||||
<div class="item{{if eq .MergeStyle "squash"}} active selected{{end}}" data-do="squash">{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}</div>
|
{{if $prUnit.PullRequestsConfig.AllowSquash}}
|
||||||
{{end}}
|
<div class="item{{if eq .MergeStyle "squash"}} active selected{{end}}" data-do="squash">{{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
Loading…
Reference in a new issue