summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/ucode/dispatcher.uc4
-rw-r--r--modules/luci-lua-runtime/luasrc/dispatcher.lua6
-rw-r--r--modules/luci-lua-runtime/luasrc/template.lua2
3 files changed, 10 insertions, 2 deletions
diff --git a/modules/luci-base/ucode/dispatcher.uc b/modules/luci-base/ucode/dispatcher.uc
index c996c76af1..0644a756c2 100644
--- a/modules/luci-base/ucode/dispatcher.uc
+++ b/modules/luci-base/ucode/dispatcher.uc
@@ -774,7 +774,9 @@ function render_action(fn) {
function run_action(request_path, lang, tree, resolved, action) {
switch (action?.type) {
case 'template':
- runtime.render(action.path, {});
+ render_action(() => {
+ runtime.call('luci.dispatcher', 'render_lua_template', action.path);
+ });
break;
case 'view':
diff --git a/modules/luci-lua-runtime/luasrc/dispatcher.lua b/modules/luci-lua-runtime/luasrc/dispatcher.lua
index 608b9b6674..93f7f8949b 100644
--- a/modules/luci-lua-runtime/luasrc/dispatcher.lua
+++ b/modules/luci-lua-runtime/luasrc/dispatcher.lua
@@ -354,6 +354,12 @@ function invoke_form_action(model, ...)
_G.L.include("footer")
end
+function render_lua_template(path)
+ local tpl = require "luci.template"
+
+ tpl.render(path, getfenv(1))
+end
+
function call(name, ...)
return {
diff --git a/modules/luci-lua-runtime/luasrc/template.lua b/modules/luci-lua-runtime/luasrc/template.lua
index 84fb8bb338..b6b9af0bad 100644
--- a/modules/luci-lua-runtime/luasrc/template.lua
+++ b/modules/luci-lua-runtime/luasrc/template.lua
@@ -121,7 +121,7 @@ context.viewns = setmetatable({
elseif key == "resource" then
return L.config.main.resourcebase
else
- return rawget(tbl, key) or disp[key] or _G[key] or L[key]
+ return rawget(tbl, key) or _G[key] or L[key]
end
end})