Backport #14133 Fix #14111 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
fae18bdac0
commit
bf1441b1e1
2 changed files with 14 additions and 1 deletions
|
@ -5,6 +5,8 @@
|
||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
"code.gitea.io/gitea/models"
|
||||||
|
@ -71,6 +73,8 @@ func UnadoptedRepos(ctx *context.Context) {
|
||||||
opts.Page = 1
|
opts.Page = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.Data["CurrentPage"] = opts.Page
|
||||||
|
|
||||||
doSearch := ctx.QueryBool("search")
|
doSearch := ctx.QueryBool("search")
|
||||||
|
|
||||||
ctx.Data["search"] = doSearch
|
ctx.Data["search"] = doSearch
|
||||||
|
@ -79,6 +83,7 @@ func UnadoptedRepos(ctx *context.Context) {
|
||||||
if !doSearch {
|
if !doSearch {
|
||||||
pager := context.NewPagination(0, opts.PageSize, opts.Page, 5)
|
pager := context.NewPagination(0, opts.PageSize, opts.Page, 5)
|
||||||
pager.SetDefaultParams(ctx)
|
pager.SetDefaultParams(ctx)
|
||||||
|
pager.AddParam(ctx, "search", "search")
|
||||||
ctx.Data["Page"] = pager
|
ctx.Data["Page"] = pager
|
||||||
ctx.HTML(200, tplUnadoptedRepos)
|
ctx.HTML(200, tplUnadoptedRepos)
|
||||||
return
|
return
|
||||||
|
@ -92,6 +97,7 @@ func UnadoptedRepos(ctx *context.Context) {
|
||||||
ctx.Data["Dirs"] = repoNames
|
ctx.Data["Dirs"] = repoNames
|
||||||
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
|
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
|
||||||
pager.SetDefaultParams(ctx)
|
pager.SetDefaultParams(ctx)
|
||||||
|
pager.AddParam(ctx, "search", "search")
|
||||||
ctx.Data["Page"] = pager
|
ctx.Data["Page"] = pager
|
||||||
ctx.HTML(200, tplUnadoptedRepos)
|
ctx.HTML(200, tplUnadoptedRepos)
|
||||||
}
|
}
|
||||||
|
@ -100,6 +106,9 @@ func UnadoptedRepos(ctx *context.Context) {
|
||||||
func AdoptOrDeleteRepository(ctx *context.Context) {
|
func AdoptOrDeleteRepository(ctx *context.Context) {
|
||||||
dir := ctx.Query("id")
|
dir := ctx.Query("id")
|
||||||
action := ctx.Query("action")
|
action := ctx.Query("action")
|
||||||
|
page := ctx.QueryInt("page")
|
||||||
|
q := ctx.Query("q")
|
||||||
|
|
||||||
dirSplit := strings.SplitN(dir, "/", 2)
|
dirSplit := strings.SplitN(dir, "/", 2)
|
||||||
if len(dirSplit) != 2 {
|
if len(dirSplit) != 2 {
|
||||||
ctx.Redirect(setting.AppSubURL + "/admin/repos")
|
ctx.Redirect(setting.AppSubURL + "/admin/repos")
|
||||||
|
@ -141,5 +150,5 @@ func AdoptOrDeleteRepository(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
ctx.Flash.Success(ctx.Tr("repo.delete_preexisting_success", dir))
|
ctx.Flash.Success(ctx.Tr("repo.delete_preexisting_success", dir))
|
||||||
}
|
}
|
||||||
ctx.Redirect(setting.AppSubURL + "/admin/repos/unadopted")
|
ctx.Redirect(setting.AppSubURL + "/admin/repos/unadopted?search=true&q=" + url.QueryEscape(q) + "&page=" + strconv.Itoa(page))
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
{{$.CsrfTokenHtml}}
|
{{$.CsrfTokenHtml}}
|
||||||
<input type="hidden" name="id" value="{{$dir}}">
|
<input type="hidden" name="id" value="{{$dir}}">
|
||||||
<input type="hidden" name="action" value="adopt">
|
<input type="hidden" name="action" value="adopt">
|
||||||
|
<input type="hidden" name="q" value="{{$.Keyword}}">
|
||||||
|
<input type="hidden" name="page" value="{{$.CurrentPage}}">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<div class="ui red basic inverted cancel button">
|
<div class="ui red basic inverted cancel button">
|
||||||
<i class="remove icon"></i>
|
<i class="remove icon"></i>
|
||||||
|
@ -66,6 +68,8 @@
|
||||||
{{$.CsrfTokenHtml}}
|
{{$.CsrfTokenHtml}}
|
||||||
<input type="hidden" name="id" value="{{$dir}}">
|
<input type="hidden" name="id" value="{{$dir}}">
|
||||||
<input type="hidden" name="action" value="delete">
|
<input type="hidden" name="action" value="delete">
|
||||||
|
<input type="hidden" name="q" value="{{$.Keyword}}">
|
||||||
|
<input type="hidden" name="page" value="{{$.CurrentPage}}">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<div class="ui red basic inverted cancel button">
|
<div class="ui red basic inverted cancel button">
|
||||||
<i class="remove icon"></i>
|
<i class="remove icon"></i>
|
||||||
|
|
Reference in a new issue