mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 12:22:11 +00:00
feat: wiki search using git-grep
+ add release note
This commit is contained in:
parent
d6915f4d5f
commit
ec4f5495ba
10 changed files with 107 additions and 0 deletions
|
@ -40,6 +40,7 @@ const (
|
|||
tplWikiRevision base.TplName = "repo/wiki/revision"
|
||||
tplWikiNew base.TplName = "repo/wiki/new"
|
||||
tplWikiPages base.TplName = "repo/wiki/pages"
|
||||
tplWikiSearch base.TplName = "repo/wiki/search"
|
||||
)
|
||||
|
||||
// MustEnableWiki check if wiki is enabled, if external then redirect
|
||||
|
@ -795,3 +796,20 @@ func DeleteWikiPagePost(ctx *context.Context) {
|
|||
|
||||
ctx.JSONRedirect(ctx.Repo.RepoLink + "/wiki/")
|
||||
}
|
||||
|
||||
func WikiSearchContent(ctx *context.Context) {
|
||||
keyword := ctx.FormTrim("q")
|
||||
if keyword == "" {
|
||||
ctx.HTML(http.StatusOK, tplWikiSearch)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := wiki_service.SearchWikiContents(ctx, ctx.Repo.Repository, keyword)
|
||||
if err != nil {
|
||||
ctx.ServerError("SearchWikiContents", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["Results"] = res
|
||||
ctx.HTML(http.StatusOK, tplWikiSearch)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue