gitea源码

new.tmpl 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <h2 class="ui dividing header">
  2. {{if .PageIsEditProjects}}
  3. {{ctx.Locale.Tr "repo.projects.edit"}}
  4. <div class="sub header">{{ctx.Locale.Tr "repo.projects.edit_subheader"}}</div>
  5. {{else}}
  6. {{ctx.Locale.Tr "repo.projects.new"}}
  7. <div class="sub header">{{ctx.Locale.Tr "repo.projects.new_subheader"}}</div>
  8. {{end}}
  9. </h2>
  10. {{template "base/alert" .}}
  11. <form class="ui form" action="{{.Link}}" method="post">
  12. {{.CsrfTokenHtml}}
  13. <div>
  14. <input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
  15. <div class="field {{if .Err_Title}}error{{end}}">
  16. <label>{{ctx.Locale.Tr "repo.projects.title"}}</label>
  17. <input name="title" placeholder="{{ctx.Locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
  18. </div>
  19. <div class="field">
  20. <label>{{ctx.Locale.Tr "repo.projects.description"}}</label>
  21. {{/* TODO: repo-level project and org-level project have different behaviros to render */}}
  22. {{/* the "Repository" is nil when the project is org-level */}}
  23. {{template "shared/combomarkdowneditor" (dict
  24. "MarkdownPreviewInRepo" $.Repository
  25. "MarkdownPreviewContext" (Iif $.Repository "" .HomeLink)
  26. "MarkdownPreviewMode" (Iif $.Repository "comment")
  27. "TextareaName" "content"
  28. "TextareaContent" .content
  29. "TextareaPlaceholder" (ctx.Locale.Tr "repo.projects.description_placeholder")
  30. )}}
  31. </div>
  32. {{if not .PageIsEditProjects}}
  33. <div class="field">
  34. <label>{{ctx.Locale.Tr "repo.projects.template.desc"}}</label>
  35. <div class="ui selection dropdown">
  36. <input type="hidden" name="template_type" value="{{.type}}">
  37. <div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div>
  38. <div class="menu">
  39. {{range $element := .TemplateConfigs}}
  40. <div class="item" data-id="{{$element.TemplateType}}" data-value="{{$element.TemplateType}}">{{ctx.Locale.Tr $element.Translation}}</div>
  41. {{end}}
  42. </div>
  43. </div>
  44. </div>
  45. {{end}}
  46. <div class="field">
  47. <label>{{ctx.Locale.Tr "repo.projects.card_type.desc"}}</label>
  48. <div class="ui selection dropdown">
  49. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  50. {{range $element := .CardTypes}}
  51. {{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}}
  52. <input type="hidden" name="card_type" value="{{$element.CardType}}">
  53. <div class="default text">{{ctx.Locale.Tr $element.Translation}}</div>
  54. {{end}}
  55. {{end}}
  56. <div class="menu">
  57. {{range $element := .CardTypes}}
  58. <div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{ctx.Locale.Tr $element.Translation}}</div>
  59. {{end}}
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="divider"></div>
  65. <div class="flex-text-block tw-justify-end">
  66. <a class="ui cancel button" href="{{$.CancelLink}}">
  67. {{ctx.Locale.Tr "repo.milestones.cancel"}}
  68. </a>
  69. <button class="ui primary button">
  70. {{if .PageIsEditProjects}}{{ctx.Locale.Tr "repo.projects.modify"}}{{else}}{{ctx.Locale.Tr "repo.projects.create"}}{{end}}
  71. </button>
  72. </div>
  73. </form>