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 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {{template "base/head" .}}
  2. <div class="repository file editor edit">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <form class="ui edit form" 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.editor.name_your_file"}}" data-ec-url-prefix="{{$.EditorconfigURLPrefix}}" required autofocus>
  19. <span class="poping up" data-content="{{$.i18n.Tr "repo.editor.filename_help"}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-info" 16}}</span>
  20. {{else}}
  21. <span class="section"><a href="{{EscapePound $.BranchLink}}/{{index $.TreePaths $i | EscapePound}}">{{$v}}</a></span>
  22. {{end}}
  23. {{end}}
  24. <span>{{.i18n.Tr "repo.editor.or"}} <a href="{{EscapePound $.BranchLink}}{{if not .IsNewFile}}/{{EscapePound .TreePath}}{{end}}">{{.i18n.Tr "repo.editor.cancel_lower"}}</a></span>
  25. <input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" 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">{{svg "octicon-code" 16}} {{if .IsNewFile}}{{.i18n.Tr "repo.editor.new_file"}}{{else}}{{.i18n.Tr "repo.editor.edit_file"}}{{end}}</a>
  32. {{if not .IsNewFile}}
  33. <a class="item" data-tab="preview" data-url="{{.Repository.APIURL}}/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL | EscapePound}}" data-preview-file-modes="{{.PreviewableFileModes}}">{{svg "octicon-eye" 16}} {{.i18n.Tr "preview"}}</a>
  34. <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName | EscapePound}}/{{.TreePath | EscapePound}}" data-context="{{.BranchLink}}">{{svg "octicon-diff" 16}} {{.i18n.Tr "repo.editor.preview_changes"}}</a>
  35. {{end}}
  36. </div>
  37. <div class="ui bottom attached active tab segment" data-tab="write">
  38. <textarea id="edit_area" name="content" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
  39. data-url="{{.Repository.APIURL}}/markdown"
  40. data-context="{{.RepoLink}}"
  41. data-markdown-file-exts="{{.MarkdownFileExts}}"
  42. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  43. {{.FileContent}}</textarea>
  44. </div>
  45. <div class="ui bottom attached tab segment markdown" data-tab="preview">
  46. {{.i18n.Tr "loading"}}
  47. </div>
  48. <div class="ui bottom attached tab segment diff" data-tab="diff">
  49. {{.i18n.Tr "loading"}}
  50. </div>
  51. </div>
  52. {{template "repo/editor/commit_form" .}}
  53. </form>
  54. </div>
  55. <div class="ui small basic modal" id="edit-empty-content-modal">
  56. <div class="ui icon header">
  57. <i class="file icon"></i>
  58. {{.i18n.Tr "repo.editor.commit_empty_file_header"}}
  59. </div>
  60. <div class="center content">
  61. <p>{{.i18n.Tr "repo.editor.commit_empty_file_text"}}</p>
  62. </div>
  63. <div class="actions">
  64. <div class="ui red basic cancel inverted button">
  65. <i class="remove icon"></i>
  66. {{.i18n.Tr "repo.editor.cancel"}}
  67. </div>
  68. <div class="ui green basic ok inverted button">
  69. <i class="save icon"></i>
  70. {{.i18n.Tr "repo.editor.commit_changes"}}
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. {{template "base/footer" .}}