diff options
author | yp05327 <576951401@qq.com> | 2023-10-18 09:03:42 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 00:03:42 +0000 |
commit | 8abc1aae4ab5b03be0bcbdd390bb903b54ccd21a (patch) | |
tree | 4f7e0f7cd8f70ab5a9014b26280514f89660a9be /routers/web/repo | |
parent | eeb1e0242b24497ba77ac834288fcaa54d4dc588 (diff) | |
download | gitea-8abc1aae4ab5b03be0bcbdd390bb903b54ccd21a.tar.gz gitea-8abc1aae4ab5b03be0bcbdd390bb903b54ccd21a.zip |
Improve the list header in milestone page (#27302)
The ui of list header in milestone page is not same as issue and pr list
page.
And they are using different template codes which can be merged into
one.
Before:
![image](https://github.com/go-gitea/gitea/assets/18380374/29eb426c-2dd6-4cf2-96e0-82339fb631bb)
![image](https://github.com/go-gitea/gitea/assets/18380374/b36c4dff-469a-4395-8a02-a8c54e17ab21)
![image](https://github.com/go-gitea/gitea/assets/18380374/d882c74a-451b-431d-b58e-3635a15d9718)
![image](https://github.com/go-gitea/gitea/assets/18380374/292cd38d-1b50-47f1-b32c-9b5de90ce5fb)
After:
![image](https://github.com/go-gitea/gitea/assets/18380374/4529234e-67dc-4e17-9440-e638be4fbc41)
![image](https://github.com/go-gitea/gitea/assets/18380374/c15b4d86-0762-497b-b28d-72d09443d629)
---------
Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
Diffstat (limited to 'routers/web/repo')
-rw-r--r-- | routers/web/repo/issue.go | 17 | ||||
-rw-r--r-- | routers/web/repo/milestone.go | 6 |
2 files changed, 19 insertions, 4 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 279214bcf0..3fd25f81fb 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -246,6 +246,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti isShowClosed = true } + archived := ctx.FormBool("archived") + page := ctx.FormInt("page") if page <= 1 { page = 1 @@ -417,6 +419,15 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti ctx.Data["PinnedIssues"] = pinned ctx.Data["IsRepoAdmin"] = ctx.IsSigned && (ctx.Repo.IsAdmin() || ctx.Doer.IsAdmin) ctx.Data["IssueStats"] = issueStats + ctx.Data["OpenCount"] = issueStats.OpenCount + ctx.Data["ClosedCount"] = issueStats.ClosedCount + linkStr := "%s?q=%s&type=%s&sort=%s&state=%s&labels=%s&milestone=%d&project=%d&assignee=%d&poster=%d&archived=%t" + ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Link, + url.QueryEscape(keyword), url.QueryEscape(viewType), url.QueryEscape(sortType), "open", url.QueryEscape(selectLabels), + mentionedID, projectID, assigneeID, posterID, archived) + ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Link, + url.QueryEscape(keyword), url.QueryEscape(viewType), url.QueryEscape(sortType), "closed", url.QueryEscape(selectLabels), + mentionedID, projectID, assigneeID, posterID, archived) ctx.Data["SelLabelIDs"] = labelIDs ctx.Data["SelectLabels"] = selectLabels ctx.Data["ViewType"] = viewType @@ -432,6 +443,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti } else { ctx.Data["State"] = "open" } + ctx.Data["ShowArchivedLabels"] = archived pager.AddParam(ctx, "q", "Keyword") pager.AddParam(ctx, "type", "ViewType") @@ -442,11 +454,8 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti pager.AddParam(ctx, "project", "ProjectID") pager.AddParam(ctx, "assignee", "AssigneeID") pager.AddParam(ctx, "poster", "PosterID") + pager.AddParam(ctx, "archived", "ShowArchivedLabels") - if ctx.FormBool("archived") { - ctx.Data["ShowArchivedLabels"] = true - pager.AddParam(ctx, "archived", "ShowArchivedLabels") - } ctx.Data["Page"] = pager } diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index 32cbc29c67..4db02fce9e 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -4,6 +4,7 @@ package repo import ( + "fmt" "net/http" "net/url" "time" @@ -72,6 +73,11 @@ func Milestones(ctx *context.Context) { } ctx.Data["OpenCount"] = stats.OpenCount ctx.Data["ClosedCount"] = stats.ClosedCount + linkStr := "%s/milestones?state=%s&q=%s&sort=%s" + ctx.Data["OpenLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "open", + url.QueryEscape(keyword), url.QueryEscape(sortType)) + ctx.Data["ClosedLink"] = fmt.Sprintf(linkStr, ctx.Repo.RepoLink, "closed", + url.QueryEscape(keyword), url.QueryEscape(sortType)) if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) { if err := miles.LoadTotalTrackedTimes(ctx); err != nil { |