summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorRoger Luo <rogerluo410@gmail.com>2021-04-08 19:53:59 +0800
committerGitHub <noreply@github.com>2021-04-08 13:53:59 +0200
commitfa06e98553b78da66cb75e13cffe56b3ef013447 (patch)
treea448a47ea1f0f7643d705a9da6bbe106d7e9eff7 /routers/repo
parent0d1a5e0ffcf689e6e6b2aaa4a4251db74f6b487b (diff)
downloadgitea-fa06e98553b78da66cb75e13cffe56b3ef013447.tar.gz
gitea-fa06e98553b78da66cb75e13cffe56b3ef013447.zip
Add dashboard milestone search and repo milestone search by name (#14866)
Feature for issue #13845: - Add milestones search by name on dashboard milestones page. - Add milestones search by name on repo issue/milestones page.
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/milestone.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/routers/repo/milestone.go b/routers/repo/milestone.go
index 4d1fc022c2..5a9d2351bc 100644
--- a/routers/repo/milestone.go
+++ b/routers/repo/milestone.go
@@ -6,6 +6,7 @@ package repo
import (
"net/http"
+ "strings"
"time"
"code.gitea.io/gitea/models"
@@ -44,6 +45,9 @@ func Milestones(ctx *context.Context) {
ctx.Data["ClosedCount"] = stats.ClosedCount
sortType := ctx.Query("sort")
+
+ keyword := strings.Trim(ctx.Query("q"), " ")
+
page := ctx.QueryInt("page")
if page <= 1 {
page = 1
@@ -67,6 +71,7 @@ func Milestones(ctx *context.Context) {
RepoID: ctx.Repo.Repository.ID,
State: state,
SortType: sortType,
+ Name: keyword,
})
if err != nil {
ctx.ServerError("GetMilestones", err)
@@ -90,10 +95,12 @@ func Milestones(ctx *context.Context) {
}
ctx.Data["SortType"] = sortType
+ ctx.Data["Keyword"] = keyword
ctx.Data["IsShowClosed"] = isShowClosed
pager := context.NewPagination(total, setting.UI.IssuePagingNum, page, 5)
pager.AddParam(ctx, "state", "State")
+ pager.AddParam(ctx, "q", "Keyword")
ctx.Data["Page"] = pager
ctx.HTML(http.StatusOK, tplMilestone)