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.

edit.tmpl 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. {{template "base/head" .}}
  2. <div class="repository file editor">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <form class="ui edit form" action="{{EscapePound $.Link}}" method="post">
  7. {{.CsrfTokenHtml}}
  8. <input type="hidden" name="last_commit" value="{{.last_commit}}">
  9. <div class="ui secondary menu">
  10. <div class="fitted item treepath">
  11. <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">
  12. <a class="section" href="{{EscapePound $.BranchLink}}">{{.Repository.Name}}</a>
  13. {{ $n := len .TreeNames}}
  14. {{ $l := Subtract $n 1}}
  15. {{range $i, $v := .TreeNames}}
  16. <div class="divider"> / </div>
  17. {{if eq $i $l}}
  18. <input id="file-name" value="{{$v}}" placeholder="{{$.i18n.Tr "repo.name_your_file"}}" required autofocus>
  19. <span class="octicon octicon-info poping up" data-content="{{$.i18n.Tr "repo.filename_help"}}" data-position="bottom center" data-variation="tiny"></span>
  20. {{else}}
  21. <span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $v}}">{{$v}}</a></span>
  22. {{end}}
  23. {{end}}
  24. <!-- <button class="clipboard-tree-name octicon octicon-clippy poping up" type="button" data-content="{{.i18n.Tr "repo.copy_file_path_to_clipboard"}}" data-position="bottom center" data-variation="tiny inverted"></button> -->
  25. <span class="repo-edit-file-cancel">{{.i18n.Tr "repo.or"}} <a href="{{EscapePound $.BranchLink}}{{if not .IsNewFile}}/{{EscapePound .TreePath}}{{end}}">{{.i18n.Tr "repo.cancel_lower"}}</a></span>
  26. <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="field">
  31. <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
  32. <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.new_file"}}{{else}}{{.i18n.Tr "repo.edit_file"}}{{end}}</a>
  33. {{if not .IsNewFile}}
  34. <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a>
  35. <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreePath}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.preview_changes"}}</a>
  36. {{end}}
  37. </div>
  38. <div class="ui bottom attached active tab segment" data-tab="write">
  39. <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
  40. data-url="{{AppSubUrl}}/api/v1/markdown"
  41. data-context="{{.RepoLink}}"
  42. data-markdown-file-exts="{{.MarkdownFileExts}}"
  43. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  44. {{.FileContent}}</textarea required>
  45. </div>
  46. <div class="ui bottom attached tab segment markdown" data-tab="preview">
  47. {{.i18n.Tr "repo.release.loading"}}
  48. </div>
  49. <div class="ui bottom attached tab segment diff" data-tab="diff">
  50. {{.i18n.Tr "repo.release.loading"}}
  51. </div>
  52. </div>
  53. <div class="commit-form-wrapper">
  54. <img width="48" height="48" class="ui image commit-avatar" src="{{.SignedUser.AvatarLink}}">
  55. <div class="commit-form">
  56. <h3>{{.i18n.Tr "repo.commit_changes"}}</h3>
  57. <div class="field">
  58. <input name="commit_summary" placeholder="{{if .IsNewFile}}{{.i18n.Tr "repo.add"}} '{{.TreePath}}/<filename>'{{else}}{{.i18n.Tr "repo.update"}} '{{.TreePath}}'{{end}}" value="{{.commit_summary}}">
  59. </div>
  60. <div class="field">
  61. <textarea name="commit_message" placeholder="{{.i18n.Tr "repo.default_commit_message"}}" rows="5">{{.commit_message}}</textarea>
  62. </div>
  63. <div class="quick-pull-choice js-quick-pull-choice">
  64. <div class="field">
  65. <div class="ui radio checkbox">
  66. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct" {{if eq .commit_choice "direct"}}checked{{end}}>
  67. <label>
  68. <i class="octicon octicon-git-commit" height="16" width="14"></i>
  69. {{.i18n.Tr "repo.editor.commit_directly_to_this_branch" .BranchName | Safe}}
  70. </label>
  71. </div>
  72. </div>
  73. <div class="field">
  74. <div class="ui radio checkbox">
  75. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch" {{if eq .commit_choice "commit-to-new-branch"}}checked{{end}}>
  76. <label>
  77. <i class="octicon octicon-git-pull-request" height="16" width="12"></i>
  78. {{.i18n.Tr "repo.editor.create_new_branch" | Safe}}
  79. </label>
  80. </div>
  81. </div>
  82. <div class="quick-pull-branch-name {{if not (eq .commit_choice "commit-to-new-branch")}}hide{{end}}">
  83. <div class="new-branch-name-input{{if .Err_NewBranchName}} error{{end}}">
  84. <i class="octicon octicon-git-branch" height="16" width="10"></i>
  85. <input type="text" name="new_branch_name" value="{{.new_branch_name}}" class="form-control input-contrast mr-2 js-quick-pull-new-branch-name" placeholder="New branch name…">
  86. <span class="text-muted js-quick-pull-normalization-info"></span>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <button type="submit" class="ui green button">
  92. {{.i18n.Tr "repo.commit_changes"}}
  93. </button>
  94. <a class="ui button red" href="{{EscapePound $.BranchLink}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.cancel"}}</a>
  95. </div>
  96. </form>
  97. </div>
  98. </div>
  99. {{template "base/footer" .}}