editor.commit_message_desc = Add an optional extended description… | editor.commit_message_desc = Add an optional extended description… | ||||
editor.commit_directly_to_this_branch = Commit directly to the <strong class="branch-name">%s</strong> branch. | editor.commit_directly_to_this_branch = Commit directly to the <strong class="branch-name">%s</strong> branch. | ||||
editor.create_new_branch = Create a <strong>new branch</strong> for this commit and start a pull request. | editor.create_new_branch = Create a <strong>new branch</strong> for this commit and start a pull request. | ||||
editor.create_new_branch_np = Create a <strong>new branch</strong> for this commit. | |||||
editor.propose_file_change = Propose file change | editor.propose_file_change = Propose file change | ||||
editor.new_branch_name_desc = New branch name… | editor.new_branch_name_desc = New branch name… | ||||
editor.cancel = Cancel | editor.cancel = Cancel |
} | } | ||||
} | } | ||||
if form.CommitChoice == frmCommitChoiceNewBranch { | |||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | |||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | ||||
} else { | } else { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ||||
} | } | ||||
ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath)) | ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath)) | ||||
if form.CommitChoice == frmCommitChoiceNewBranch { | |||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | |||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | ||||
} else { | } else { | ||||
treePath := filepath.Dir(ctx.Repo.TreePath) | treePath := filepath.Dir(ctx.Repo.TreePath) | ||||
return | return | ||||
} | } | ||||
if form.CommitChoice == frmCommitChoiceNewBranch { | |||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { | |||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName) | ||||
} else { | } else { | ||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) | ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) |
</div> | </div> | ||||
</div> | </div> | ||||
<div class="field"> | <div class="field"> | ||||
{{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}} | |||||
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} | |||||
<div class="ui radio checkbox"> | <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> | <label> | ||||
<i class="octicon octicon-git-pull-request" height="16" width="12"></i> | <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> | </label> | ||||
</div> | </div> | ||||
</div> | </div> |