diff options
-rw-r--r-- | models/project_board.go | 4 | ||||
-rw-r--r-- | routers/repo/projects.go | 24 | ||||
-rw-r--r-- | templates/repo/projects/view.tmpl | 12 | ||||
-rw-r--r-- | web_src/less/_repository.less | 2 |
4 files changed, 38 insertions, 4 deletions
diff --git a/models/project_board.go b/models/project_board.go index 8ffa218377..a9c0b3ed8b 100644 --- a/models/project_board.go +++ b/models/project_board.go @@ -256,6 +256,10 @@ func (b *ProjectBoard) LoadIssues() (IssueList, error) { issueList = append(issueList, issues...) } + if err := IssueList(issueList).LoadComments(); err != nil { + return nil, err + } + b.Issues = issueList return issueList, nil } diff --git a/routers/repo/projects.go b/routers/repo/projects.go index d3cdab6b75..4cff199b34 100644 --- a/routers/repo/projects.go +++ b/routers/repo/projects.go @@ -280,10 +280,32 @@ func ViewProject(ctx *context.Context) { boards[0].Title = ctx.Tr("repo.projects.type.uncategorized") } - if ctx.Data["Issues"], err = boards.LoadIssues(); err != nil { + issueList, err := boards.LoadIssues() + if err != nil { ctx.ServerError("LoadIssuesOfBoards", err) return } + ctx.Data["Issues"] = issueList + + linkedPrsMap := make(map[int64][]*models.Issue) + for _, issue := range issueList { + var referencedIds []int64 + for _, comment := range issue.Comments { + if comment.RefIssueID != 0 && comment.RefIsPull { + referencedIds = append(referencedIds, comment.RefIssueID) + } + } + + if len(referencedIds) > 0 { + if linkedPrs, err := models.Issues(&models.IssuesOptions{ + IssueIDs: referencedIds, + IsPull: util.OptionalBoolTrue, + }); err == nil { + linkedPrsMap[issue.ID] = linkedPrs + } + } + } + ctx.Data["LinkedPRs"] = linkedPrsMap project.RenderedContent = string(markdown.Render([]byte(project.Description), ctx.Repo.RepoLink, ctx.Repo.Repository.ComposeMetas())) diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index a3606c169c..9b2aa4bc7d 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -166,13 +166,21 @@ </span> <a class="project-board-title" href="{{$.RepoLink}}/issues/{{.Index}}">#{{.Index}} {{.Title}}</a> </div> + {{- if .MilestoneID }} <div class="meta"> - {{ if .MilestoneID }} <a class="milestone" href="{{$.RepoLink}}/milestone/{{ .MilestoneID}}"> {{svg "octicon-milestone"}} {{ .Milestone.Name }} </a> - {{ end }} </div> + {{- end }} + {{- range index $.LinkedPRs .ID }} + <div class="meta"> + <a href="{{$.RepoLink}}/pulls/{{ .ID }}"> + <span class="{{if .PullRequest.HasMerged}}purple{{else if .IsClosed}}red{{else}}green{{end}}">{{svg "octicon-git-merge"}}</span> + {{ .Title}} (#{{ .ID }}) + </a> + </div> + {{- end }} </div> <div class="extra content"> {{ range .Labels }} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index fa6ea4467b..57f101abb9 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2921,7 +2921,7 @@ tbody.commit-list { } .board-card .content { - padding: 5px 8px !important; + padding: 8px 8px 5px !important; } .board-card .extra.content { |