mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 11:41:32 +01:00 
			
		
		
		
	Display issue task list on project cards (#27865)
Display the issue task list on project cards.  Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		
							parent
							
								
									dc52f26d46
								
							
						
					
					
						commit
						4776fde9e1
					
				| @ -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)) | ||||
| } | ||||
|  | ||||
| @ -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}} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user