Skip to content

Commit

Permalink
Display issue task list on project cards (go-gitea#27865)
Browse files Browse the repository at this point in the history
Display the issue task list on project cards.


![grafik](https://github.com/go-gitea/gitea/assets/1666336/e6cb3196-8980-403c-9795-3a7b03fbfb3c)

Co-authored-by: Giteabot <teabot@gitea.io>
  • Loading branch information
2 people authored and fuxiaohei committed Jan 17, 2024
1 parent ae40a35 commit a693cce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 2 additions & 10 deletions models/issues/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,14 @@ type Issue struct {
}

var (
issueTasksPat *regexp.Regexp
issueTasksDonePat *regexp.Regexp
)

const (
issueTasksRegexpStr = `(^\s*[-*]\s\[[\sxX]\]\s.)|(\n\s*[-*]\s\[[\sxX]\]\s.)`
issueTasksDoneRegexpStr = `(^\s*[-*]\s\[[xX]\]\s.)|(\n\s*[-*]\s\[[xX]\]\s.)`
issueTasksPat = regexp.MustCompile(`(^\s*[-*]\s\[[\sxX]\]\s.)|(\n\s*[-*]\s\[[\sxX]\]\s.)`)
issueTasksDonePat = regexp.MustCompile(`(^\s*[-*]\s\[[xX]\]\s.)|(\n\s*[-*]\s\[[xX]\]\s.)`)
)

// IssueIndex represents the issue index table
type IssueIndex db.ResourceIndex

func init() {
issueTasksPat = regexp.MustCompile(issueTasksRegexpStr)
issueTasksDonePat = regexp.MustCompile(issueTasksDoneRegexpStr)

db.RegisterModel(new(Issue))
db.RegisterModel(new(IssueIndex))
}
Expand Down
7 changes: 7 additions & 0 deletions templates/repo/issue/card.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
</div>
{{end}}
{{end}}
{{$tasks := .GetTasks}}
{{if gt $tasks 0}}
<div class="meta gt-my-2">
{{svg "octicon-checklist" 16 "gt-mr-2 gt-vm"}}
<span class="gt-vm">{{.GetTasksDone}} / {{$tasks}}</span>
</div>
{{end}}
</div>

{{if or .Labels .Assignees}}
Expand Down

0 comments on commit a693cce

Please sign in to comment.