| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package templatehelpers
- import (
- "github.com/kataras/iris"
- "strings"
- _ "fmt"
- )
- func ShowError(ctx *iris.Context) {
- params := ctx.Get("params").(map[string]string)
- ctx.Render(params["reqDir"] + "_box.html", params)
- ctx.StopExecution()
- }
- func ShowNotification(ctx *iris.Context) {
- params := ctx.Get("params").(map[string]string)
- ctx.Render(params["reqDir"] + "_box.html", params)
- ctx.StopExecution()
- }
- func InitPageParams(ctx *iris.Context) {
- var params map[string]string
- params = make(map[string]string)
- loc := strings.TrimLeft(ctx.RequestPath(false), "/")
- if loc == "" { // if requesting / -> home
- loc = "home"
- }
- params["reqDir"] = loc
- ctx.Set("params", params)
- ctx.Next()
- }
- func UpdatePageParam(ctx *iris.Context, key string, value string) {
- params := ctx.Get("params").(map[string]string)
- params[key] = value
- ctx.Set("params", params)
- }
|