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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {{template "base/head" .}}
  2. <div role="main" aria-label="{{.Title}}" class="page-content 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. <input type="hidden" name="page_has_posted" value="{{.PageHasPosted}}">
  10. <div class="ui secondary menu">
  11. <div class="fitted item treepath">
  12. <div class="ui breadcrumb field {{if .Err_TreePath}}error{{end}}">
  13. <a class="section" href="{{$.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 id="file-name" value="{{$v}}" placeholder="{{$.locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.Editorconfig}}" required autofocus>
  20. <span class="tooltip" data-content="{{$.locale.Tr "repo.editor.filename_help"}}" data-position="bottom center">{{svg "octicon-info"}}</span>
  21. {{else}}
  22. <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span>
  23. {{end}}
  24. {{end}}
  25. <span>{{.locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}{{if not .IsNewFile}}/{{PathEscapeSegments .TreePath}}{{end}}">{{.locale.Tr "repo.editor.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">{{svg "octicon-code"}} {{if .IsNewFile}}{{.locale.Tr "repo.editor.new_file"}}{{else}}{{.locale.Tr "repo.editor.edit_file"}}{{end}}</a>
  33. {{if not .IsNewFile}}
  34. <a class="item" data-tab="preview" data-url="{{.Repository.HTMLURL}}/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-preview-file-modes="{{.PreviewableFileModes}}" data-markdown-mode="gfm">{{svg "octicon-eye"}} {{.locale.Tr "preview"}}</a>
  35. <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}" data-context="{{.BranchLink}}">{{svg "octicon-diff"}} {{.locale.Tr "repo.editor.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" class="hide" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
  40. data-url="{{.Repository.HTMLURL}}/markdown"
  41. data-context="{{.RepoLink}}"
  42. data-markdown-file-exts="{{.MarkdownFileExts}}"
  43. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  44. {{.FileContent}}</textarea>
  45. <div class="editor-loading is-loading"></div>
  46. </div>
  47. <div class="ui bottom attached tab segment markup" data-tab="preview">
  48. {{.locale.Tr "loading"}}
  49. </div>
  50. <div class="ui bottom attached tab segment diff edit-diff" data-tab="diff">
  51. {{.locale.Tr "loading"}}
  52. </div>
  53. </div>
  54. {{template "repo/editor/commit_form" .}}
  55. </form>
  56. </div>
  57. <div class="ui small basic modal" id="edit-empty-content-modal">
  58. <div class="ui icon header">
  59. <i class="file icon"></i>
  60. {{.locale.Tr "repo.editor.commit_empty_file_header"}}
  61. </div>
  62. <div class="center content">
  63. <p>{{.locale.Tr "repo.editor.commit_empty_file_text"}}</p>
  64. </div>
  65. <div class="actions">
  66. <div class="ui red basic cancel inverted button">
  67. <i class="remove icon"></i>
  68. {{.locale.Tr "repo.editor.cancel"}}
  69. </div>
  70. <div class="ui green basic ok inverted button">
  71. <i class="save icon"></i>
  72. {{.locale.Tr "repo.editor.commit_changes"}}
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. {{template "base/footer" .}}