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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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="breadcrumb-divider">/</div>
  17. {{if eq $i $l}}
  18. <input id="file-name" maxlength="500" value="{{$v}}" placeholder="{{ctx.Locale.Tr "repo.editor.name_your_file"}}" data-editorconfig="{{$.EditorconfigJson}}" required autofocus>
  19. <span data-tooltip-content="{{ctx.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>{{ctx.Locale.Tr "repo.editor.or"}} <a href="{{$.BranchLink}}{{if not .IsNewFile}}/{{PathEscapeSegments .TreePath}}{{end}}">{{ctx.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}}{{ctx.Locale.Tr "repo.editor.new_file"}}{{else}}{{ctx.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"}} {{ctx.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"}} {{ctx.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}}">{{.FileContent}}</textarea>
  42. <div class="editor-loading is-loading"></div>
  43. </div>
  44. <div class="ui bottom attached tab segment markup" data-tab="preview">
  45. {{ctx.Locale.Tr "loading"}}
  46. </div>
  47. <div class="ui bottom attached tab segment diff edit-diff" data-tab="diff">
  48. {{ctx.Locale.Tr "loading"}}
  49. </div>
  50. </div>
  51. {{template "repo/editor/commit_form" .}}
  52. </form>
  53. </div>
  54. <div class="ui g-modal-confirm modal" id="edit-empty-content-modal">
  55. <div class="header">
  56. {{svg "octicon-file"}}
  57. {{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}
  58. </div>
  59. <div class="center content">
  60. <p>{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}</p>
  61. </div>
  62. <div class="actions">
  63. <button class="ui cancel button">
  64. {{svg "octicon-x"}}
  65. {{ctx.Locale.Tr "repo.editor.cancel"}}
  66. </button>
  67. <button class="ui primary ok button">
  68. {{svg "fontawesome-save"}}
  69. {{ctx.Locale.Tr "repo.editor.commit_changes"}}
  70. </button>
  71. </div>
  72. </div>
  73. </div>
  74. {{template "base/footer" .}}