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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {{template "base/head" .}}
  2. <div class="repository file edit">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. {{.branchName}}
  6. {{template "base/alert" .}}
  7. <form class="ui edit form" action="{{EscapePound $.Link}}" method="post">
  8. {{.CsrfTokenHtml}}
  9. <input type="hidden" name="last_commit" value="{{.LastCommit}}">
  10. <div class="ui secondary menu">
  11. <div class="item fitted" style="width:100%;">
  12. <div class="ui breadcrumb field{{if .Err_Filename}} error{{end}}">
  13. <a class="section" href="{{EscapePound $.BranchLink}}">{{.Repository.Name}}</a>
  14. {{ $n := len .TreeNames}}
  15. {{ $l := Subtract $n 1}}
  16. {{range $i, $v := .TreeNames}}
  17. <div class="divider"> / </div>
  18. {{if eq $i $l}}
  19. <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>
  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}}/{{EscapePound $.TreeName}}">{{.i18n.Tr "repo.cancel_lower"}}</a></span>
  26. <input type="hidden" id="tree-name" name="tree_name" value="{{.TreeName}}" 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> {{.i18n.Tr "repo.edit_file"}}</a>
  33. <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>
  34. <a class="item" data-tab="diff" data-url="{{.PreviewDiffURL}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.preview_changes"}}</a>
  35. </div>
  36. <div class="ui bottom attached active tab segment" data-tab="write">
  37. <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreeName}}"
  38. data-url="{{AppSubUrl}}/api/v1/markdown"
  39. data-context="{{.RepoLink}}"
  40. data-markdown-file-exts="{{.MarkdownFileExts}}"
  41. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  42. {{.FileContent}}</textarea required>
  43. </div>
  44. <div class="ui bottom attached tab segment markdown" data-tab="preview">
  45. {{.i18n.Tr "repo.release.loading"}}
  46. </div>
  47. <div class="ui bottom attached tab segment diff" data-tab="diff">
  48. {{.i18n.Tr "repo.release.loading"}}
  49. </div>
  50. </div>
  51. <div class="commit-form-wrapper">
  52. <img width="48" height="48" class="ui rounded image commit-form-avatar" src="{{.SignedUser.AvatarLink}}">
  53. <div class="commit-form">
  54. <h3>{{.i18n.Tr "repo.commit_changes"}}</h3>
  55. <div class="field">
  56. <input name="commit_summary" placeholder="{{if .IsNewFile}}{{.i18n.Tr "repo.add"}} '{{.TreeName}}/<filename>'{{else}}{{.i18n.Tr "repo.update"}} '{{.TreeName}}'{{end}}" value="{{.CommitSummary}}">
  57. </div>
  58. <div class="field">
  59. <textarea name="commit_message" placeholder="{{.i18n.Tr "repo.default_commit_message"}}">{{.CommitMessage}}</textarea>
  60. </div>
  61. <div class="quick-pull-choice js-quick-pull-choice ">
  62. <dl class="form-group">
  63. <dd>
  64. <div class="form-checkbox">
  65. <label>
  66. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="direct"{{if eq .CommitChoice "direct"}} checked="checked"{{end}}>
  67. <i class="octicon octicon-git-commit" height="16" width="14"></i>
  68. {{.CommitDirectlyToThisBranch | Safe}}
  69. </label>
  70. </div>
  71. <div class="form-checkbox">
  72. <label>
  73. <input type="radio" class="js-quick-pull-choice-option" name="commit_choice" value="commit-to-new-branch"{{if eq .CommitChoice "commit-to-new-branch"}} checked="checked"{{end}}>
  74. <i class="octicon octicon-git-pull-request" height="16" width="12"></i>
  75. {{.CreateNewBranch | Safe}}
  76. </label>
  77. </div>
  78. </dd>
  79. </dl>
  80. <div class="quick-pull-branch-name">
  81. <div class="new-branch-name-input{{if .Err_Branchname}} error{{end}}">
  82. <i class="octicon octicon-git-branch quick-pull-new-branch-icon" height="16" width="10"></i>
  83. <input type="text" name="new_branch_name" value="{{.NewBranchName}}" class="form-control input-contrast mr-2 js-quick-pull-new-branch-name" placeholder="New branch name…">
  84. <span class="text-muted js-quick-pull-normalization-info"></span>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <button type="submit" class="ui green button">
  90. {{.i18n.Tr "repo.commit_changes"}}
  91. </button>
  92. <a class="ui button red" href="{{EscapePound $.BranchLink}}/{{EscapePound $.TreeName}}">{{.i18n.Tr "repo.cancel"}}</a>
  93. </div>
  94. </form>
  95. </div>
  96. </div>
  97. {{template "base/footer" .}}