gitea源码

commit_form.tmpl 4.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <div class="commit-form-wrapper">
  2. {{ctx.AvatarUtils.Avatar .SignedUser 40 "commit-avatar"}}
  3. <div class="commit-form avatar-content-left-arrow">
  4. <h3>
  5. {{- if .CommitFormOptions.WillSign}}
  6. <span data-tooltip-content="{{ctx.Locale.Tr "repo.signing.will_sign" .CommitFormOptions.SigningKeyFormDisplay}}">{{svg "octicon-lock" 24}}</span>
  7. {{ctx.Locale.Tr "repo.editor.commit_signed_changes"}}
  8. {{- else}}
  9. <span title="{{ctx.Locale.Tr (printf "repo.signing.wont_sign.%s" .CommitFormOptions.WontSignReason)}}">{{svg "octicon-unlock" 24}}</span>
  10. {{ctx.Locale.Tr "repo.editor.commit_changes"}}
  11. {{- end}}
  12. </h3>
  13. <div class="field">
  14. <input name="commit_summary" maxlength="100" placeholder="{{if .PageIsDelete}}{{ctx.Locale.Tr "repo.editor.delete" .TreePath}}{{else if .PageIsUpload}}{{ctx.Locale.Tr "repo.editor.upload_files_to_dir" .TreePath}}{{else if .IsNewFile}}{{ctx.Locale.Tr "repo.editor.add_tmpl"}}{{else if .PageIsPatch}}{{ctx.Locale.Tr "repo.editor.patch"}}{{else}}{{ctx.Locale.Tr "repo.editor.update" .TreePath}}{{end}}" value="{{.commit_summary}}" autofocus>
  15. </div>
  16. <div class="field">
  17. <textarea name="commit_message" placeholder="{{ctx.Locale.Tr "repo.editor.commit_message_desc"}}" rows="5">{{.commit_message}}</textarea>
  18. </div>
  19. <div class="inline field">
  20. <div class="ui checkbox">
  21. <input name="signoff" type="checkbox">
  22. <label>{{ctx.Locale.Tr "repo.editor.signoff_desc"}}</label>
  23. </div>
  24. </div>
  25. <div class="quick-pull-choice js-quick-pull-choice">
  26. <div class="field">
  27. <div class="ui radio checkbox {{if not .CommitFormOptions.CanCommitToBranch}}disabled{{end}}">
  28. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "direct"}}checked{{end}}>
  29. <label>
  30. {{svg "octicon-git-commit"}}
  31. {{ctx.Locale.Tr "repo.editor.commit_directly_to_this_branch" .BranchName}}
  32. {{if not .CommitFormOptions.CanCommitToBranch}}
  33. <div class="ui visible small warning message">
  34. {{ctx.Locale.Tr "repo.editor.no_commit_to_branch"}}
  35. <ul>
  36. {{if not .CommitFormOptions.UserCanPush}}<li>{{ctx.Locale.Tr "repo.editor.user_no_push_to_branch"}}</li>{{end}}
  37. {{if and .CommitFormOptions.RequireSigned (not .CommitFormOptions.WillSign)}}<li>{{ctx.Locale.Tr "repo.editor.require_signed_commit"}}</li>{{end}}
  38. </ul>
  39. </div>
  40. {{end}}
  41. </label>
  42. </div>
  43. </div>
  44. {{if and (not .Repository.IsEmpty) (not .IsEditingFileOnly)}}
  45. <div class="field">
  46. <div class="ui radio checkbox">
  47. {{if .CommitFormOptions.CanCreatePullRequest}}
  48. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" data-button-text="{{ctx.Locale.Tr "repo.editor.propose_file_change"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
  49. {{else}}
  50. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" data-button-text="{{ctx.Locale.Tr "repo.editor.commit_changes"}}" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
  51. {{end}}
  52. <label>
  53. {{svg "octicon-git-pull-request"}}
  54. {{if .CommitFormOptions.CanCreatePullRequest}}
  55. {{ctx.Locale.Tr "repo.editor.create_new_branch"}}
  56. {{else}}
  57. {{ctx.Locale.Tr "repo.editor.create_new_branch_np"}}
  58. {{end}}
  59. </label>
  60. </div>
  61. </div>
  62. <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}tw-hidden{{end}}">
  63. <div class="new-branch-name-input field">
  64. {{svg "octicon-git-branch"}}
  65. <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"}}">
  66. <span class="text-muted js-quick-pull-normalization-info"></span>
  67. </div>
  68. </div>
  69. {{end}}
  70. </div>
  71. {{if and .CommitCandidateEmails (gt (len .CommitCandidateEmails) 1)}}
  72. <div class="field">
  73. <label>{{ctx.Locale.Tr "repo.editor.commit_email"}}</label>
  74. <select class="ui selection dropdown" name="commit_email">
  75. {{- range $email := .CommitCandidateEmails -}}
  76. <option {{if eq $email $.CommitDefaultEmail}}selected{{end}} value="{{$email}}">{{$email}}</option>
  77. {{- end -}}
  78. </select>
  79. </div>
  80. {{end}}
  81. </div>
  82. <input type="hidden" name="last_commit" value="{{.last_commit}}">
  83. <button id="commit-button" type="submit" class="ui primary button">
  84. {{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}}
  85. </button>
  86. <a class="ui button red" href="{{if .ReturnURI}}{{.ReturnURI}}{{else}}{{$.BranchLink}}/{{PathEscapeSegments .TreePath}}{{end}}">{{ctx.Locale.Tr "repo.editor.cancel"}}</a>
  87. </div>