edit.tmpl 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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="octicon octicon-info poping up" data-content="{{$.i18n.Tr "repo.editor.filename_help"}}" data-position="bottom center" data-variation="tiny inverted"></span>
  20. {{else}}
  21. <span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $v}}">{{$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"><i class="octicon octicon-code"></i> {{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="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchName}}" 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="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreePath}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.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="{{AppSubUrl}}/api/v1/markdown"
  40. data-context="{{.RepoLink}}"
  41. data-markdown-file-exts="{{.MarkdownFileExts}}"
  42. data-line-wrap-extensions="{{.LineWrapExtensions}}">
  43. {{.FileContent}}</textarea required>
  44. </div>
  45. <div class="ui bottom attached tab segment markdown" data-tab="preview">
  46. {{.i18n.Tr "repo.release.loading"}}
  47. </div>
  48. <div class="ui bottom attached tab segment diff" data-tab="diff">
  49. {{.i18n.Tr "repo.release.loading"}}
  50. </div>
  51. </div>
  52. {{template "repo/editor/commit_form" .}}
  53. </form>
  54. </div>
  55. </div>
  56. {{template "base/footer" .}}