luci-lua-runtime: render cbi header/footer templates via ucode runtime

Trigger rendering of CBI header and footer templates via the ucode runtime
`include()` in order to ensure that scope data is properly inherited from
Lua templates (`cbi/header`) including ucode templates (`header`).

This fixes automatic triggering of the config apply flow on legacy Lua CBI
forms.

Ref: https://github.com/openwrt/luci/pull/6056#issuecomment-1292396588
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-10-26 21:59:08 +02:00
parent aca4591753
commit a98e2ea17d

View file

@ -267,7 +267,7 @@ function invoke_cbi_action(model, config, ...)
http:header("X-CBI-State", state or 0) http:header("X-CBI-State", state or 0)
if not config.noheader then if not config.noheader then
tpl.render("cbi/header", {state = state}) _G.L.include("cbi/header", {state = state})
end end
local redirect local redirect
@ -318,7 +318,7 @@ function invoke_cbi_action(model, config, ...)
end end
if not config.nofooter then if not config.nofooter then
tpl.render("cbi/footer", { _G.L.include("cbi/footer", {
flow = config, flow = config,
pageaction = pageaction, pageaction = pageaction,
redirect = redirect, redirect = redirect,