gitea源码

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2024 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package project
  4. type (
  5. // TemplateType is used to represent a project template type
  6. TemplateType uint8
  7. // TemplateConfig is used to identify the template type of project that is being created
  8. TemplateConfig struct {
  9. TemplateType TemplateType
  10. Translation string
  11. }
  12. )
  13. const (
  14. // TemplateTypeNone is a project template type that has no predefined columns
  15. TemplateTypeNone TemplateType = iota
  16. // TemplateTypeBasicKanban is a project template type that has basic predefined columns
  17. TemplateTypeBasicKanban
  18. // TemplateTypeBugTriage is a project template type that has predefined columns suited to hunting down bugs
  19. TemplateTypeBugTriage
  20. )
  21. // GetTemplateConfigs retrieves the template configs of configurations project columns could have
  22. func GetTemplateConfigs() []TemplateConfig {
  23. return []TemplateConfig{
  24. {TemplateTypeNone, "repo.projects.type.none"},
  25. {TemplateTypeBasicKanban, "repo.projects.type.basic_kanban"},
  26. {TemplateTypeBugTriage, "repo.projects.type.bug_triage"},
  27. }
  28. }
  29. // IsTemplateTypeValid checks if the project template type is valid
  30. func IsTemplateTypeValid(p TemplateType) bool {
  31. switch p {
  32. case TemplateTypeNone, TemplateTypeBasicKanban, TemplateTypeBugTriage:
  33. return true
  34. default:
  35. return false
  36. }
  37. }