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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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="repo-editor-header">
  11. <div class="ui breadcrumb field{{if .Err_TreePath}} error{{end}}">
  12. <a class="section" href="{{$.BranchLink}}">{{.Repository.Name}}</a>
  13. {{$n := len .TreeNames}}
  14. {{$l := Eval $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="{{$.locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.Editorconfig}}" required autofocus>
  19. <span data-tooltip-content="{{$.locale.Tr "repo.editor.filename_help"}}">{{svg "octicon-info"}}</span>
  20. {{else}}
  21. <span class="section"><a href="{{$.BranchLink}}/{{index $.TreePaths $i | PathEscapeSegments}}">{{$v}}</a></span>
  22. {{end}}
  23. {{end}}
  24. <span>{{.locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}{{if not .IsNewFile}}/{{PathEscapeSegments .TreePath}}{{end}}">{{.locale.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 class="field">
  29. <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff">
  30. <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>
  31. <a class="item" data-tab="preview" data-url="{{.Repository.Link}}/markup" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-markup-mode="file">{{svg "octicon-eye"}} {{.locale.Tr "preview"}}</a>
  32. {{if not .IsNewFile}}
  33. <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>
  34. {{end}}
  35. </div>
  36. <div class="ui bottom attached active tab segment" data-tab="write">
  37. <textarea id="edit_area" name="content" class="gt-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
  38. data-url="{{.Repository.Link}}/markup"
  39. data-context="{{.RepoLink}}"
  40. data-previewable-extensions="{{.PreviewableExtensions}}"
  41. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  42. {{.FileContent}}</textarea>
  43. <div class="editor-loading is-loading"></div>
  44. </div>
  45. <div class="ui bottom attached tab segment markup" data-tab="preview">
  46. {{.locale.Tr "loading"}}
  47. </div>
  48. <div class="ui bottom attached tab segment diff edit-diff" data-tab="diff">
  49. {{.locale.Tr "loading"}}
  50. </div>
  51. </div>
  52. {{template "repo/editor/commit_form" .}}
  53. </form>
  54. </div>
  55. <div class="ui g-modal-confirm modal" id="edit-empty-content-modal">
  56. <div class="header">
  57. {{svg "octicon-file"}}
  58. {{.locale.Tr "repo.editor.commit_empty_file_header"}}
  59. </div>
  60. <div class="center content">
  61. <p>{{.locale.Tr "repo.editor.commit_empty_file_text"}}</p>
  62. </div>
  63. <div class="actions">
  64. <button class="ui red cancel button">
  65. {{svg "octicon-x"}}
  66. {{.locale.Tr "repo.editor.cancel"}}
  67. </button>
  68. <button class="ui green ok button">
  69. {{svg "fontawesome-save"}}
  70. {{.locale.Tr "repo.editor.commit_changes"}}
  71. </button>
  72. </div>
  73. </div>
  74. </div>
  75. {{template "base/footer" .}}