]> source.dussan.org Git - gitea.git/commitdiff
Allow adding multiple issues to a project (#17226)
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>
Thu, 7 Oct 2021 22:00:02 +0000 (00:00 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Oct 2021 22:00:02 +0000 (00:00 +0200)
Adds an option like for adding multiple issues to a milestone.
Closes #17216

routers/web/repo/issue.go
templates/repo/issue/list.tmpl

index 64c4ae41f450786d9b1144e58b0c1ac3e7c264e6..1aaa27c2b00e321e2a01d785cb7e5566eb377d2d 100644 (file)
@@ -327,6 +327,20 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
                }
                return 0
        }
+
+       if ctx.Repo.CanWriteIssuesOrPulls(ctx.Params(":type") == "pulls") {
+               projects, _, err := models.GetProjects(models.ProjectSearchOptions{
+                       RepoID:   repo.ID,
+                       Type:     models.ProjectTypeRepository,
+                       IsClosed: util.OptionalBoolOf(isShowClosed),
+               })
+               if err != nil {
+                       ctx.ServerError("GetProjects", err)
+                       return
+               }
+               ctx.Data["Projects"] = projects
+       }
+
        ctx.Data["IssueStats"] = issueStats
        ctx.Data["SelLabelIDs"] = labelIDs
        ctx.Data["SelectLabels"] = selectLabels
index 904b4d8bd0866e8a75465fbf8b63fc2c9617bbd4..64b68f145eee34ae55c69086d44f53a882c31a86 100644 (file)
                                                </div>
                                        </div>
 
+                                       <!-- Projects -->
+                                       <div class="ui {{if not .Projects}}disabled{{end}} dropdown jump item">
+                                               <span class="text">
+                                                       {{.i18n.Tr "repo.project_board"}}
+                                                       {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+                                               </span>
+                                               <div class="menu">
+                                                       <div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects">
+                                                       {{.i18n.Tr "repo.issues.new.no_projects"}}
+                                                       </div>
+                                                       {{range .Projects}}
+                                                               <div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
+                                                                       {{.Title}}
+                                                               </div>
+                                                       {{end}}
+                                               </div>
+                                       </div>
+
                                        <!-- Assignees -->
                                        <div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
                                                <span class="text">