{{$.Project.Title}}
-{{.locale.Tr "repo.projects.deletion_desc"}}
-diff --git a/models/project/project.go b/models/project/project.go index 17348a944340..8056aba252d0 100644 --- a/models/project/project.go +++ b/models/project/project.go @@ -198,6 +198,7 @@ type SearchOptions struct { IsClosed util.OptionalBool OrderBy db.SearchOrderBy Type Type + Title string } func (opts *SearchOptions) toConds() builder.Cond { @@ -218,6 +219,10 @@ func (opts *SearchOptions) toConds() builder.Cond { if opts.OwnerID > 0 { cond = cond.And(builder.Eq{"owner_id": opts.OwnerID}) } + + if len(opts.Title) != 0 { + cond = cond.And(db.BuildCaseInsensitiveLike("title", opts.Title)) + } return cond } diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go index 34888f1550b4..4032162b5cf2 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 b8662e060556..eef57f46272f 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) } diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index e59e279c0030..0cb619c06601 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -1,25 +1,36 @@ {{if and $.CanWriteProjects (not $.Repository.IsArchived)}} -
{{.locale.Tr "repo.projects.deletion_desc"}}
+{{ctx.Locale.Tr "repo.projects.deletion_desc"}}
{{.locale.Tr "repo.projects.deletion_desc"}}
-