gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 form-fetch-action" method="post" action="{{.CommitFormOptions.TargetFormAction}}"
  7. data-text-empty-confirm-header="{{ctx.Locale.Tr "repo.editor.commit_empty_file_header"}}"
  8. data-text-empty-confirm-content="{{ctx.Locale.Tr "repo.editor.commit_empty_file_text"}}"
  9. >
  10. {{.CsrfTokenHtml}}
  11. {{template "repo/editor/common_top" .}}
  12. <div class="repo-editor-header">
  13. {{template "repo/editor/common_breadcrumb" .}}
  14. </div>
  15. {{if not .NotEditableReason}}
  16. <div class="field">
  17. <div class="ui top attached header">
  18. <div class="ui compact small menu small-menu-items repo-editor-menu">
  19. <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>
  20. <a class="item" data-tab="preview" data-preview-url="{{.Repository.Link}}/markup" data-preview-context-ref="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}">{{svg "octicon-eye"}} {{ctx.Locale.Tr "preview"}}</a>
  21. {{if not .IsNewFile}}
  22. <a class="item" data-tab="diff" hx-params="context,content" hx-vals='{"context":"{{.BranchLink}}"}' hx-include="#edit_area" hx-swap="innerHTML" hx-target=".tab[data-tab='diff']" hx-indicator=".tab[data-tab='diff']" hx-post="{{.RepoLink}}/_preview/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">{{svg "octicon-diff"}} {{ctx.Locale.Tr "repo.editor.preview_changes"}}</a>
  23. {{end}}
  24. </div>
  25. </div>
  26. <div class="ui bottom attached segment tw-p-0">
  27. <div class="ui active tab tw-rounded-b" data-tab="write">
  28. <textarea id="edit_area" name="content" class="tw-hidden" data-id="repo-{{.Repository.Name}}-{{.TreePath}}"
  29. data-previewable-extensions="{{.PreviewableExtensions}}"
  30. data-line-wrap-extensions="{{.LineWrapExtensions}}">{{.FileContent}}</textarea>
  31. <div class="editor-loading is-loading"></div>
  32. </div>
  33. <div class="ui tab tw-px-4 tw-py-3" data-tab="preview">
  34. {{ctx.Locale.Tr "loading"}}
  35. </div>
  36. <div class="ui tab" data-tab="diff">
  37. <div class="tw-p-16"></div>
  38. </div>
  39. </div>
  40. </div>
  41. {{else}}
  42. <div class="field">
  43. <div class="ui segment tw-text-center">
  44. <h4 class="tw-font-semibold tw-mb-2">{{.NotEditableReason}}</h4>
  45. <p>{{ctx.Locale.Tr "repo.editor.file_not_editable_hint"}}</p>
  46. </div>
  47. </div>
  48. {{end}}
  49. {{template "repo/editor/commit_form" .}}
  50. </form>
  51. </div>
  52. </div>
  53. {{template "base/footer" .}}