You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commit_form.tmpl 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <div class="commit-form-wrapper">
  2. <img width="48" height="48" class="ui image commit-avatar" src="{{.SignedUser.RelAvatarLink}}">
  3. <div class="commit-form">
  4. <h3>{{- if .CanCommitToBranch.WillSign}}
  5. <i title="{{.i18n.Tr "repo.signing.will_sign" .CanCommitToBranch.SigningKey}}" class="lock green icon"></i>{{.i18n.Tr "repo.editor.commit_signed_changes"}}
  6. {{- else}}
  7. <i title="{{.i18n.Tr (printf "repo.signing.wont_sign.%s" .CanCommitToBranch.WontSignReason)}}" class="unlock grey icon"></i>{{.i18n.Tr "repo.editor.commit_changes"}}
  8. {{- end}}</h3>
  9. <div class="field">
  10. <input name="commit_summary" placeholder="{{if .PageIsDelete}}{{.i18n.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{.i18n.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{.i18n.Tr "repo.editor.add_tmpl"}}{{else}}{{.i18n.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus>
  11. </div>
  12. <div class="field">
  13. <textarea name="commit_message" placeholder="{{.i18n.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea>
  14. </div>
  15. <div class="quick-pull-choice js-quick-pull-choice">
  16. <div class="field">
  17. <div class="ui radio checkbox {{if not .CanCommitToBranch.CanCommitToBranch}}disabled{{end}}">
  18. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" button_text="{{.i18n.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "direct"}}checked{{end}}>
  19. <label>
  20. {{svg "octicon-git-commit" 16}}
  21. {{.i18n.Tr "repo.editor.commit_directly_to_this_branch" (.BranchName|Escape) | Safe}}
  22. {{if not .CanCommitToBranch.CanCommitToBranch}}
  23. <div class="ui visible small warning message">
  24. {{.i18n.Tr "repo.editor.no_commit_to_branch"}}
  25. <ul>
  26. {{if not .CanCommitToBranch.UserCanPush}}<li>{{.i18n.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}}
  27. {{if and .CanCommitToBranch.RequireSigned (not .CanCommitToBranch.WillSign)}}<li>{{.i18n.Tr "repo.editor.require_signed_commit"}}</li>{{end}}
  28. </ul>
  29. </div>
  30. {{end}}
  31. </label>
  32. </div>
  33. </div>
  34. <div class="field">
  35. {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}}
  36. {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}}
  37. <div class="ui radio checkbox">
  38. {{if $pullRequestEnabled}}
  39. <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}}>
  40. {{else}}
  41. <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}}>
  42. {{end}}
  43. <label>
  44. {{svg "octicon-git-pull-request" 16}}
  45. {{if $pullRequestEnabled}}
  46. {{.i18n.Tr "repo.editor.create_new_branch" | Safe}}
  47. {{else}}
  48. {{.i18n.Tr "repo.editor.create_new_branch_np" | Safe}}
  49. {{end}}
  50. </label>
  51. </div>
  52. </div>
  53. <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}hide{{end}}">
  54. <div class="new-branch-name-input field {{if .Err_NewBranchName}}error{{end}}">
  55. {{svg "octicon-git-branch" 16}}
  56. <input type="text" name="new_branch_name" value="{{.new_branch_name}}" class="input-contrast mr-2 js-quick-pull-new-branch-name" placeholder="{{.i18n.Tr "repo.editor.new_branch_name_desc"}}" {{if eq .commit_choice "commit-to-new-branch"}}required{{end}}>
  57. <span class="text-muted js-quick-pull-normalization-info"></span>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <button id="commit-button" type="submit" class="ui green button">
  63. {{if eq .commit_choice "commit-to-new-branch"}}{{.i18n.Tr "repo.editor.propose_file_change"}}{{else}}{{.i18n.Tr "repo.editor.commit_changes"}}{{end}}
  64. </button>
  65. <a class="ui button red" href="{{EscapePound $.BranchLink}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.editor.cancel"}}</a>
  66. </div>