Skip to content

Commit cd0928f

Browse files
authored
Allow adding multiple issues to a project (#17226)
Adds an option like for adding multiple issues to a milestone. Closes #17216
1 parent 25a2000 commit cd0928f

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Diff for: routers/web/repo/issue.go

+14
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
327327
}
328328
return 0
329329
}
330+
331+
if ctx.Repo.CanWriteIssuesOrPulls(ctx.Params(":type") == "pulls") {
332+
projects, _, err := models.GetProjects(models.ProjectSearchOptions{
333+
RepoID: repo.ID,
334+
Type: models.ProjectTypeRepository,
335+
IsClosed: util.OptionalBoolOf(isShowClosed),
336+
})
337+
if err != nil {
338+
ctx.ServerError("GetProjects", err)
339+
return
340+
}
341+
ctx.Data["Projects"] = projects
342+
}
343+
330344
ctx.Data["IssueStats"] = issueStats
331345
ctx.Data["SelLabelIDs"] = labelIDs
332346
ctx.Data["SelectLabels"] = selectLabels

Diff for: templates/repo/issue/list.tmpl

+18
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,24 @@
166166
</div>
167167
</div>
168168

169+
<!-- Projects -->
170+
<div class="ui {{if not .Projects}}disabled{{end}} dropdown jump item">
171+
<span class="text">
172+
{{.i18n.Tr "repo.project_board"}}
173+
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
174+
</span>
175+
<div class="menu">
176+
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects">
177+
{{.i18n.Tr "repo.issues.new.no_projects"}}
178+
</div>
179+
{{range .Projects}}
180+
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
181+
{{.Title}}
182+
</div>
183+
{{end}}
184+
</div>
185+
</div>
186+
169187
<!-- Assignees -->
170188
<div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
171189
<span class="text">

0 commit comments

Comments
 (0)