diff options
author | Roger Luo <rogerluo410@gmail.com> | 2021-04-08 19:53:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 13:53:59 +0200 |
commit | fa06e98553b78da66cb75e13cffe56b3ef013447 (patch) | |
tree | a448a47ea1f0f7643d705a9da6bbe106d7e9eff7 /routers/repo | |
parent | 0d1a5e0ffcf689e6e6b2aaa4a4251db74f6b487b (diff) | |
download | gitea-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.go | 7 |
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) |