From ab78c39e4152e6d2e3ace594a24b6e13cb3a1678 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Sat, 12 Aug 2023 12:30:28 +0200 Subject: Refactor project templates (#26448) This PR refactors a bunch of projects-related code, mostly the templates. The following things were done: - rename boards to columns in frontend code - use the new `ctx.Locale.Tr` method - cleanup template, remove useless newlines, classes, comments - merge org-/user and repo level project template together - move "new column" button into project toolbar - move issue card (shared by projects and pinned issues) to shared template, remove useless duplicated styles - add search function to projects (to make the layout more similar to milestones list where it is inherited from :laughing:) - maybe more changes I forgot I've done :laughing: Closes #24893 After: ![Bildschirmfoto vom 2023-08-10 23-02-00](https://github.com/go-gitea/gitea/assets/47871822/cab61456-1d23-4373-8163-e567f1b3b5f9) ![Bildschirmfoto vom 2023-08-10 23-02-26](https://github.com/go-gitea/gitea/assets/47871822/94b55d60-5572-48eb-8111-538a52d8bcc6) ![Bildschirmfoto vom 2023-08-10 23-02-46](https://github.com/go-gitea/gitea/assets/47871822/a0358f4b-4e05-4194-a7bc-6e0ecba5a9b6) --------- Co-authored-by: silverwind --- routers/web/org/projects.go | 4 +++- routers/web/repo/projects.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'routers/web') diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go index 34888f1550..4032162b5c 100644 --- a/routers/web/org/projects.go +++ b/routers/web/org/projects.go @@ -47,6 +47,7 @@ func Projects(ctx *context.Context) { sortType := ctx.FormTrim("sort") isShowClosed := strings.ToLower(ctx.FormTrim("state")) == "closed" + keyword := ctx.FormTrim("q") page := ctx.FormInt("page") if page <= 1 { page = 1 @@ -64,6 +65,7 @@ func Projects(ctx *context.Context) { IsClosed: util.OptionalBoolOf(isShowClosed), OrderBy: project_model.GetSearchOrderByBySortType(sortType), Type: projectType, + Title: keyword, }) if err != nil { ctx.ServerError("FindProjects", err) @@ -395,7 +397,7 @@ func ViewProject(ctx *context.Context) { ctx.Data["CanWriteProjects"] = canWriteProjects(ctx) ctx.Data["Project"] = project ctx.Data["IssuesMap"] = issuesMap - ctx.Data["Boards"] = boards + ctx.Data["Columns"] = boards // TODO: rename boards to columns in backend shared_user.RenderUserHeader(ctx) err = shared_user.LoadHeaderCount(ctx) diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index b8662e0605..eef57f4627 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -54,6 +54,7 @@ func Projects(ctx *context.Context) { sortType := ctx.FormTrim("sort") isShowClosed := strings.ToLower(ctx.FormTrim("state")) == "closed" + keyword := ctx.FormTrim("q") repo := ctx.Repo.Repository page := ctx.FormInt("page") if page <= 1 { @@ -76,6 +77,7 @@ func Projects(ctx *context.Context) { IsClosed: util.OptionalBoolOf(isShowClosed), OrderBy: project_model.GetSearchOrderByBySortType(sortType), Type: project_model.TypeRepository, + Title: keyword, }) if err != nil { ctx.ServerError("GetProjects", err) @@ -364,7 +366,7 @@ func ViewProject(ctx *context.Context) { ctx.Data["CanWriteProjects"] = ctx.Repo.Permission.CanWrite(unit.TypeProjects) ctx.Data["Project"] = project ctx.Data["IssuesMap"] = issuesMap - ctx.Data["Boards"] = boards + ctx.Data["Columns"] = boards // TODO: rename boards to columns in backend ctx.HTML(http.StatusOK, tplProjectsView) } -- cgit v1.2.3