summaryrefslogtreecommitdiffstats
path: root/models/project/template.go
blob: 06d5d2af1482bc19370d24bfedf1e19d1fd0bc8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package project

type (
	// TemplateType is used to represent a project template type
	TemplateType uint8

	// TemplateConfig is used to identify the template type of project that is being created
	TemplateConfig struct {
		TemplateType TemplateType
		Translation  string
	}
)

const (
	// TemplateTypeNone is a project template type that has no predefined columns
	TemplateTypeNone TemplateType = iota

	// TemplateTypeBasicKanban is a project template type that has basic predefined columns
	TemplateTypeBasicKanban

	// TemplateTypeBugTriage is a project template type that has predefined columns suited to hunting down bugs
	TemplateTypeBugTriage
)

// GetTemplateConfigs retrieves the template configs of configurations project columns could have
func GetTemplateConfigs() []TemplateConfig {
	return []TemplateConfig{
		{TemplateTypeNone, "repo.projects.type.none"},
		{TemplateTypeBasicKanban, "repo.projects.type.basic_kanban"},
		{TemplateTypeBugTriage, "repo.projects.type.bug_triage"},
	}
}

// IsTemplateTypeValid checks if the project template type is valid
func IsTemplateTypeValid(p TemplateType) bool {
	switch p {
	case TemplateTypeNone, TemplateTypeBasicKanban, TemplateTypeBugTriage:
		return true
	default:
		return false
	}
}