|
39 | 39 | </label> |
40 | 40 | </div> |
41 | 41 | </div> |
42 | | - {{if not .Repository.IsEmpty}} |
43 | | - <div class="field"> |
44 | | - <div class="ui radio checkbox"> |
45 | | - {{if .CanCreatePullRequest}} |
46 | | - <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{ctx.Locale.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> |
47 | | - {{else}} |
48 | | - <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> |
49 | | - {{end}} |
50 | | - <label> |
51 | | - {{svg "octicon-git-pull-request"}} |
| 42 | + {{if and (not .Repository.IsEmpty) (not .IsEditingFileOnly)}} |
| 43 | + <div class="field"> |
| 44 | + <div class="ui radio checkbox"> |
52 | 45 | {{if .CanCreatePullRequest}} |
53 | | - {{ctx.Locale.Tr "repo.editor.create_new_branch"}} |
| 46 | + <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{ctx.Locale.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> |
54 | 47 | {{else}} |
55 | | - {{ctx.Locale.Tr "repo.editor.create_new_branch_np"}} |
| 48 | + <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" button_text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}> |
56 | 49 | {{end}} |
57 | | - </label> |
| 50 | + <label> |
| 51 | + {{svg "octicon-git-pull-request"}} |
| 52 | + {{if .CanCreatePullRequest}} |
| 53 | + {{ctx.Locale.Tr "repo.editor.create_new_branch"}} |
| 54 | + {{else}} |
| 55 | + {{ctx.Locale.Tr "repo.editor.create_new_branch_np"}} |
| 56 | + {{end}} |
| 57 | + </label> |
| 58 | + </div> |
58 | 59 | </div> |
59 | | - </div> |
60 | | - <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}tw-hidden{{end}}"> |
61 | | - <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}"> |
62 | | - {{svg "octicon-git-branch"}} |
63 | | - <input type="text" name="new_branch_name" maxlength="100" value="{{.new_branch_name}}" class="input-contrast tw-mr-1 js-quick-pull-new-branch-name" placeholder="{{ctx.Locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{ctx.Locale.Tr "repo.editor.new_branch_name"}}"> |
64 | | - <span class="text-muted js-quick-pull-normalization-info"></span> |
| 60 | + <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}tw-hidden{{end}}"> |
| 61 | + <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}"> |
| 62 | + {{svg "octicon-git-branch"}} |
| 63 | + <input type="text" name="new_branch_name" maxlength="100" value="{{.new_branch_name}}" class="input-contrast tw-mr-1 js-quick-pull-new-branch-name" placeholder="{{ctx.Locale.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}} title="{{ctx.Locale.Tr "repo.editor.new_branch_name"}}"> |
| 64 | + <span class="text-muted js-quick-pull-normalization-info"></span> |
| 65 | + </div> |
65 | 66 | </div> |
66 | | - </div> |
67 | 67 | {{end}} |
68 | 68 | </div> |
69 | 69 | </div> |
70 | 70 | <button id="commit-button" type="submit" class="ui primary button"> |
71 | 71 | {{if eq .commit_choice "commit-to-new-branch"}}{{ctx.Locale.Tr "repo.editor.propose_file_change"}}{{else}}{{ctx.Locale.Tr "repo.editor.commit_changes"}}{{end}} |
72 | 72 | </button> |
73 | | - <a class="ui button red" href="{{$.BranchLink}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.editor.cancel"}}</a> |
| 73 | + <a class="ui button red" href="{{if .ReturnURI}}{{.ReturnURI}}{{else}}{{$.BranchLink}}/{{PathEscapeSegments .TreePath}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel"}}</a> |
74 | 74 | </div> |
0 commit comments