1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-27 02:59:47 +02:00

allow controller to change view layout

This commit is contained in:
Xuan Sang LE
2018-08-22 19:50:52 +02:00
parent 0ee4a9314f
commit 3eefab1bdb
4 changed files with 6 additions and 28 deletions

View File

@ -27,6 +27,10 @@ function BaseController:redirect(url)
std.header_flush()
end
function BaseController:setLayout(name)
self.registry.layout = name
end
function BaseController:setSession(key, value)
SESSION[key] = value
end

View File

@ -75,7 +75,7 @@ function Router:delegate()
end
-- now require the main page to put the view
local fn, e = loadscript(WWW_ROOT..DIR_SEP.."index.ls")
local fn, e = loadscript(VIEW_ROOT..DIR_SEP..self.registry.layout..DIR_SEP.."index.ls")
html()
if fn then
local r,o = pcall(fn, views)