From a2be178ce81461eefbf36e8c50a76b8ea3e6414c Mon Sep 17 00:00:00 2001
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 18 Aug 2018 13:56:00 +0200
Subject: [PATCH] gluon-web: add view helper for JSON-encoded values

Can be used for inserting Lua values into inline JS code.
---
 package/gluon-web/luasrc/usr/lib/lua/gluon/web/dispatcher.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/gluon-web/luasrc/usr/lib/lua/gluon/web/dispatcher.lua b/package/gluon-web/luasrc/usr/lib/lua/gluon/web/dispatcher.lua
index b003a0860..7f5b4c8b1 100644
--- a/package/gluon-web/luasrc/usr/lib/lua/gluon/web/dispatcher.lua
+++ b/package/gluon-web/luasrc/usr/lib/lua/gluon/web/dispatcher.lua
@@ -87,6 +87,7 @@ local function dispatch(config, http, request)
 		pcdata      = util.pcdata,
 		urlencode   = proto.urlencode,
 		attr        = attr,
+		json        = json.stringify,
 		url         = function(path) return build_url(http, path) end,
 	}, { __index = _G }))
 
-- 
GitLab