Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[重新提交] 如果info页面完全使用自定义plugin,detail页面使用官方plugin,那么删除记录后,应该跳回到自定义页面 #310

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
5 changes: 4 additions & 1 deletion plugins/admin/controller/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ func isInfoUrl(s string) bool {
sub := reg.FindStringSubmatch(s)
return len(sub) > 2 && !strings.Contains(sub[2], "/")
}

func isDetailUrl(s string, p string) bool {
reg, _ := regexp.Compile("(.*?)info/" + p + "/detail")
return reg.MatchString(s)
}
func isNewUrl(s string, p string) bool {
reg, _ := regexp.Compile("(.*?)info/" + p + "/new")
return reg.MatchString(s)
Expand Down
5 changes: 5 additions & 0 deletions plugins/admin/controller/detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (h *Handler) ShowDetail(ctx *context.Context) {
info = panel.GetInfo()
formModel = newPanel.GetForm()
fieldList = make(types.FieldList, 0)
referer = ctx.Referer()
)

if len(detail.FieldList) == 0 {
Expand Down Expand Up @@ -71,6 +72,10 @@ func (h *Handler) ShowDetail(ctx *context.Context) {
editUrl = user.GetCheckPermissionByUrlMethod(editUrl, h.route("show_edit").Method())
deleteUrl = user.GetCheckPermissionByUrlMethod(deleteUrl, h.route("delete").Method())

if referer != "" && !isInfoUrl(referer) && !isDetailUrl(referer, ctx.Query(constant.PrefixKey)) {
infoUrl = referer
}

deleteJs := ""

if deleteUrl != "" {
Expand Down