mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-05 23:34:19 -04:00
Show all projects, not just repo projects and open/closed projects (#22640)
This PR fixes two problems. One is when filter repository issues, only repository level projects are listed. Another is if you list open issues, only open projects will be displayed in filter options and if you list closed issues, only closed projects will be displayed in filter options. In this PR, both repository level and org/user level projects will be displayed in filter, and both open and closed projects will be listed as filter items. --------- Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
parent
4d20a4a1ba
commit
8574a6433f
@ -27,3 +27,9 @@ const (
|
|||||||
SearchOrderByForks SearchOrderBy = "num_forks ASC"
|
SearchOrderByForks SearchOrderBy = "num_forks ASC"
|
||||||
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC"
|
SearchOrderByForksReverse SearchOrderBy = "num_forks DESC"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Which means a condition to filter the records which don't match any id.
|
||||||
|
// It's different from zero which means the condition could be ignored.
|
||||||
|
NoneID = -1
|
||||||
|
)
|
||||||
|
@ -1251,6 +1251,8 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
|
|||||||
if opts.ProjectID > 0 {
|
if opts.ProjectID > 0 {
|
||||||
sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id").
|
sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id").
|
||||||
And("project_issue.project_id=?", opts.ProjectID)
|
And("project_issue.project_id=?", opts.ProjectID)
|
||||||
|
} else if opts.ProjectID == db.NoneID { // show those that are in no project
|
||||||
|
sess.And(builder.NotIn("issue.id", builder.Select("issue_id").From("project_issue")))
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.ProjectBoardID != 0 {
|
if opts.ProjectBoardID != 0 {
|
||||||
|
@ -1306,7 +1306,8 @@ issues.filter_label_no_select = All labels
|
|||||||
issues.filter_milestone = Milestone
|
issues.filter_milestone = Milestone
|
||||||
issues.filter_milestone_no_select = All milestones
|
issues.filter_milestone_no_select = All milestones
|
||||||
issues.filter_project = Project
|
issues.filter_project = Project
|
||||||
issues.filter_project_no_select = All projects
|
issues.filter_project_all = All projects
|
||||||
|
issues.filter_project_none = No project
|
||||||
issues.filter_assignee = Assignee
|
issues.filter_assignee = Assignee
|
||||||
issues.filter_assginee_no_select = All assignees
|
issues.filter_assginee_no_select = All assignees
|
||||||
issues.filter_poster = Author
|
issues.filter_poster = Author
|
||||||
|
@ -363,16 +363,10 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
projects, _, err := project_model.FindProjects(ctx, project_model.SearchOptions{
|
retrieveProjects(ctx, repo)
|
||||||
RepoID: repo.ID,
|
if ctx.Written() {
|
||||||
Type: project_model.TypeRepository,
|
|
||||||
IsClosed: util.OptionalBoolOf(isShowClosed),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
ctx.ServerError("FindProjects", err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ctx.Data["Projects"] = projects
|
|
||||||
|
|
||||||
ctx.Data["IssueStats"] = issueStats
|
ctx.Data["IssueStats"] = issueStats
|
||||||
ctx.Data["SelLabelIDs"] = labelIDs
|
ctx.Data["SelLabelIDs"] = labelIDs
|
||||||
|
@ -75,19 +75,41 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Project -->
|
<!-- Project -->
|
||||||
<div class="ui {{if not .Projects}}disabled{{end}} dropdown jump item">
|
<div class="ui{{if not (or .OpenProjects .ClosedProjects)}} disabled{{end}} dropdown jump item">
|
||||||
<span class="text">
|
<span class="text">
|
||||||
{{.locale.Tr "repo.issues.filter_project"}}
|
{{.locale.Tr "repo.issues.filter_projects"}}
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
</span>
|
</span>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<div class="ui icon search input">
|
<div class="ui icon search input">
|
||||||
<i class="icon df ac jc">{{svg "octicon-search" 16}}</i>
|
<i class="icon df ac jc">{{svg "octicon-search" 16}}</i>
|
||||||
<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_project"}}">
|
<input type="text" placeholder="{{.locale.Tr "repo.issues.filter_projects"}}">
|
||||||
</div>
|
</div>
|
||||||
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_project_no_select"}}</a>
|
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_project_all"}}</a>
|
||||||
{{range .Projects}}
|
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&project=-1&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.locale.Tr "repo.issues.filter_project_none"}}</a>
|
||||||
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">{{.Title}}</a>
|
{{if .OpenProjects}}
|
||||||
|
<div class="divider"></div>
|
||||||
|
<div class="header">
|
||||||
|
{{.locale.Tr "repo.issues.new.open_projects"}}
|
||||||
|
</div>
|
||||||
|
{{range .OpenProjects}}
|
||||||
|
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
|
||||||
|
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "mr-3"}}{{else}}{{svg "octicon-project" 18 "mr-3"}}{{end}}
|
||||||
|
{{.Title}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if .ClosedProjects}}
|
||||||
|
<div class="divider"></div>
|
||||||
|
<div class="header">
|
||||||
|
{{.locale.Tr "repo.issues.new.closed_projects"}}
|
||||||
|
</div>
|
||||||
|
{{range .ClosedProjects}}
|
||||||
|
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
|
||||||
|
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "mr-3"}}{{else}}{{svg "octicon-project" 18 "mr-3"}}{{end}}
|
||||||
|
{{.Title}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -222,18 +244,38 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Projects -->
|
<!-- Projects -->
|
||||||
<div class="ui {{if not .Projects}}disabled{{end}} dropdown jump item">
|
<div class="ui{{if not (or .OpenProjects .ClosedProjects)}} disabled{{end}} dropdown jump item">
|
||||||
<span class="text">
|
<span class="text">
|
||||||
{{.locale.Tr "repo.project_board"}}
|
{{.locale.Tr "repo.project_board"}}
|
||||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||||
</span>
|
</span>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects">
|
<div class="item issue-action" data-element-id="0" data-url="{{$.Link}}/projects">
|
||||||
{{.locale.Tr "repo.issues.new.no_projects"}}
|
{{.locale.Tr "repo.issues.new.clear_projects"}}
|
||||||
</div>
|
</div>
|
||||||
{{range .Projects}}
|
{{if .OpenProjects}}
|
||||||
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
|
<div class="divider"></div>
|
||||||
{{.Title}}
|
<div class="header">
|
||||||
|
{{.locale.Tr "repo.issues.new.open_projects"}}
|
||||||
|
</div>
|
||||||
|
{{range .OpenProjects}}
|
||||||
|
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
|
||||||
|
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "mr-3"}}{{else}}{{svg "octicon-project" 18 "mr-3"}}{{end}}
|
||||||
|
{{.Title}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if .ClosedProjects}}
|
||||||
|
<div class="divider"></div>
|
||||||
|
<div class="header">
|
||||||
|
{{.locale.Tr "repo.issues.new.closed_projects"}}
|
||||||
|
</div>
|
||||||
|
{{range .ClosedProjects}}
|
||||||
|
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
|
||||||
|
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "mr-3"}}{{else}}{{svg "octicon-project" 18 "mr-3"}}{{end}}
|
||||||
|
{{.Title}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user