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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {{template "base/head" .}}
  2. <div class="repository file edit">
  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="item fitted" style="width:100%;">
  11. <div class="ui breadcrumb field{{if .Err_Filename}} 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 type="text" id="file-name" value="{{$v}}" placeholder="{{$.i18n.Tr "repo.name_your_file"}}" required> <span class="octicon octicon-info poping up" data-content="{{$.i18n.Tr "repo.filename_help"}}" data-position="bottom center" data-variation="tiny"></span>
  19. {{else}}
  20. <span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $v}}">{{$v}}</a></span>
  21. {{end}}
  22. {{end}}
  23. <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>
  24. <span class="repo-edit-file-cancel">{{.i18n.Tr "repo.or"}} <a href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreeName}}">{{.i18n.Tr "repo.cancel_lower"}}</a></span>
  25. <input type="hidden" id="tree-name" name="tree_name" value="{{.TreeName}}" required>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="field">
  30. <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
  31. <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{.i18n.Tr "repo.edit_file"}}</a>
  32. <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>
  33. <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreeName}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.preview_changes"}}</a>
  34. </div>
  35. <div class="ui bottom attached active tab segment" data-tab="write">
  36. <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreeName}}"
  37. data-url="{{AppSubUrl}}/api/v1/markdown"
  38. data-context="{{.RepoLink}}"
  39. data-markdown-file-exts="{{.MarkdownFileExts}}"
  40. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  41. {{.FileContent}}</textarea required>
  42. </div>
  43. <div class="ui bottom attached tab segment markdown" data-tab="preview">
  44. {{.i18n.Tr "repo.release.loading"}}
  45. </div>
  46. <div class="ui bottom attached tab segment diff" data-tab="diff">
  47. {{.i18n.Tr "repo.release.loading"}}
  48. </div>
  49. </div>
  50. <div class="commit-form-wrapper">
  51. <img width="48" height="48" class="ui rounded image commit-form-avatar" src="{{.SignedUser.AvatarLink}}">
  52. <div class="commit-form">
  53. <h3>{{.i18n.Tr "repo.commit_changes"}}</h3>
  54. <div class="field">
  55. <input name="commit_summary" placeholder="{{if .IsNewFile}}{{.i18n.Tr "repo.add"}} '{{.TreeName}}/<filename>'{{else}}{{.i18n.Tr "repo.update"}} '{{.TreeName}}'{{end}}" value="{{.commit_summary}}">
  56. </div>
  57. <div class="field">
  58. <textarea name="commit_message" placeholder="{{.i18n.Tr "repo.default_commit_message"}}">{{.commit_message}}</textarea>
  59. </div>
  60. <div class="quick-pull-choice js-quick-pull-choice">
  61. <dl class="form-group">
  62. <dd>
  63. <div class="form-checkbox">
  64. <label>
  65. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct"{{if eq .commit_choice "direct"}} checked="checked"{{end}}>
  66. <i class="octicon octicon-git-commit" height="16" width="14"></i>
  67. {{.i18n.Tr "repo.editor.commit_directly_to_this_branch" .BranchName | Safe}}
  68. </label>
  69. </div>
  70. <div class="form-checkbox">
  71. <label>
  72. <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="checked"{{end}}>
  73. <i class="octicon octicon-git-pull-request" height="16" width="12"></i>
  74. {{.i18n.Tr "repo.editor.create_new_branch" | Safe}}
  75. </label>
  76. </div>
  77. </dd>
  78. </dl>
  79. <div class="quick-pull-branch-name">
  80. <div class="new-branch-name-input{{if .Err_Branchname}} error{{end}}">
  81. <i class="octicon octicon-git-branch quick-pull-new-branch-icon" height="16" width="10"></i>
  82. <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…">
  83. <span class="text-muted js-quick-pull-normalization-info"></span>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <button type="submit" class="ui green button">
  89. {{.i18n.Tr "repo.commit_changes"}}
  90. </button>
  91. <a class="ui button red" href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreeName}}">{{.i18n.Tr "repo.cancel"}}</a>
  92. </div>
  93. </form>
  94. </div>
  95. </div>
  96. {{template "base/footer" .}}