|
@@ -2,6 +2,7 @@ package templatehelpers
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"github.com/kataras/iris"
|
|
"github.com/kataras/iris"
|
|
|
|
|
+ "strings"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type PageUserParams struct{
|
|
type PageUserParams struct{
|
|
@@ -15,12 +16,25 @@ type PageUserParams struct{
|
|
|
|
|
|
|
|
// TODO error handler
|
|
// TODO error handler
|
|
|
|
|
|
|
|
- func ShowError(notification string, ctx *iris.Context, location string) { // TODO: check if backend exploiteable, TODO: implement forwarding form values ?
|
|
|
|
|
- ctx.Render(location + "_box.html", PageUserParams{"1", notification, location, "", "0", []string{}})
|
|
|
|
|
|
|
+ func ShowError(options []string, ctx *iris.Context) { // TODO: check if backend exploiteable, TODO: implement forwarding form values ?
|
|
|
|
|
+ location := strings.TrimLeft(ctx.RequestPath(false), "/")
|
|
|
|
|
+ if len(options) > 1 {
|
|
|
|
|
+ if options[1] != "" {
|
|
|
|
|
+ location = options[1]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ctx.Render(location + "_box.html", PageUserParams{"1", options[0], location, "", "0", []string{}}) // TODO: Dynamic params
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- func ShowNotification(notification string, ctx *iris.Context, location string) { // TODO: check if backend exploiteable, TODO: implement forwarding form values ?
|
|
|
|
|
- ctx.Render(location + "_box.html", PageUserParams{"2", notification, location, "", "0", []string{}})
|
|
|
|
|
|
|
+ func ShowNotification(options []string, ctx *iris.Context) { // TODO: check if backend exploiteable, TODO: implement forwarding form values ?
|
|
|
|
|
+ location := strings.TrimLeft(ctx.RequestPath(false), "/")
|
|
|
|
|
+ if len(options) > 1 {
|
|
|
|
|
+ if options[1] != "" {
|
|
|
|
|
+ location = options[1]
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ctx.Render(location + "_box.html", PageUserParams{"2", options[0], location, "", "0", []string{}}) // TODO: Dynamic params
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|