aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/editor/commit_form.tmpl
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-10-04 23:09:19 -0300
committerLunny Xiao <xiaolunwen@gmail.com>2019-10-05 10:09:19 +0800
commitfb7c23f911bebcb72f170f3d8bc8343546805f3b (patch)
treea208fe4a49be0c378ce9d91f224289c0c3fec388 /templates/repo/editor/commit_form.tmpl
parentf92a0b68fed81128fa278e82aa0e3d49d74ffdf6 (diff)
downloadgitea-fb7c23f911bebcb72f170f3d8bc8343546805f3b.tar.gz
gitea-fb7c23f911bebcb72f170f3d8bc8343546805f3b.zip
Fix editor commit to new branch if PR disabled (#8375)
Diffstat (limited to 'templates/repo/editor/commit_form.tmpl')
-rw-r--r--templates/repo/editor/commit_form.tmpl14
1 files changed, 12 insertions, 2 deletions
diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl
index d22cd07b03..2ff08e3931 100644
--- a/templates/repo/editor/commit_form.tmpl
+++ b/templates/repo/editor/commit_form.tmpl
@@ -19,11 +19,21 @@
</div>
</div>
<div class="field">
+ {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}}
+ {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
<div class="ui radio checkbox">
- <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{.i18n.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
+ {{if $pullRequestEnabled}}
+ <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{.i18n.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
+ {{else}}
+ <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{.i18n.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
+ {{end}}
<label>
<i class="octicon octicon-git-pull-request" height="16" width="12"></i>
- {{.i18n.Tr "repo.editor.create_new_branch" | Safe}}
+ {{if $pullRequestEnabled}}
+ {{.i18n.Tr "repo.editor.create_new_branch" | Safe}}
+ {{else}}
+ {{.i18n.Tr "repo.editor.create_new_branch_np" | Safe}}
+ {{end}}
</label>
</div>
</div>