| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package templatehelpers
- import (
- "github.com/kataras/iris"
- "strings"
- _ "fmt"
- )
- // TODO outsource this and down to main template handler?
- // -> no ShowError/ShowNotification needed anymore?
- func ShowError(ctx *iris.Context) {
- params := ctx.Get("params").(map[string]string)
- ctx.Render(params["reqDir"] + "_box.html", params)
- }
- func ShowNotification(ctx *iris.Context) {
- params := ctx.Get("params").(map[string]string)
- ctx.Render(params["reqDir"] + "_box.html", params)
- }
- 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)
- }
|