gitea源码

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {{if not .WorkflowDispatchConfig}}
  2. <div class="ui error message tw-block">{{/* using "ui message" in "ui form" needs to force to display */}}
  3. {{if not .CurWorkflowExists}}
  4. {{ctx.Locale.Tr "actions.workflow.not_found" $.CurWorkflow}}
  5. {{else}}
  6. {{ctx.Locale.Tr "actions.workflow.has_no_workflow_dispatch" $.CurWorkflow}}
  7. {{end}}
  8. </div>
  9. {{else}}
  10. {{range $item := .WorkflowDispatchConfig.Inputs}}
  11. <div class="ui field {{if .Required}}required{{end}}">
  12. {{if eq .Type "choice"}}
  13. <label>{{or .Description .Name}}:</label>
  14. {{/* htmx won't initialize the fomantic dropdown, so it is a standard "select" input */}}
  15. <select class="ui selection dropdown" name="{{.Name}}">
  16. {{range .Options}}
  17. <option value="{{.}}" {{if eq $item.Default .}}selected{{end}}>{{.}}</option>
  18. {{end}}
  19. </select>
  20. {{else if eq .Type "boolean"}}
  21. {{/* htmx doesn't trigger our JS code to attach fomantic label to checkbox, so here we use standard checkbox */}}
  22. <label class="tw-flex flex-text-inline">
  23. <input type="checkbox" name="{{.Name}}" {{if eq .Default "true"}}checked{{end}}>
  24. {{or .Description .Name}}
  25. </label>
  26. {{else if eq .Type "number"}}
  27. <label>{{or .Description .Name}}:</label>
  28. <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}>
  29. {{else}}
  30. <label>{{or .Description .Name}}:</label>
  31. <input name="{{.Name}}" value="{{.Default}}" {{if .Required}}required{{end}}>
  32. {{end}}
  33. </div>
  34. {{end}}
  35. <div class="ui field">
  36. {{/* use autofocus here to prevent the "branch selection" dropdown from getting focus, otherwise it will auto popup */}}
  37. <button class="ui tiny primary button" autofocus type="submit">{{ctx.Locale.Tr "actions.workflow.run"}}</button>
  38. </div>
  39. {{end}}
  40. {{range .workflows}}
  41. {{if and .ErrMsg (eq .Entry.Name $.CurWorkflow)}}
  42. <div class="ui field">
  43. <div>{{svg "octicon-alert" 16 "text red"}} {{.ErrMsg}}</div>
  44. </div>
  45. {{end}}
  46. {{end}}