mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-28 18:28:21 +01:00
27 lines
604 B
Lua
27 lines
604 B
Lua
|
local view = {}
|
||
|
|
||
|
view.html = function(name)
|
||
|
local path = BLOG_ROOT.."/view/"..name..".html"
|
||
|
local f = io.open(path, "rb")
|
||
|
if f then
|
||
|
echo(f:read("*all"))
|
||
|
f:close()
|
||
|
else
|
||
|
echo("Cannot find "..path)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
view.render = function(action, data, sort)
|
||
|
view.html("top")
|
||
|
local path = BLOG_ROOT.."/view"
|
||
|
if action == "id" then
|
||
|
_G.dbmodel = data[0]
|
||
|
doscript(path.."/detail.ls")
|
||
|
else
|
||
|
_G.dbmodel = { data = data, order = sort }
|
||
|
doscript(path.."/entries.ls")
|
||
|
end
|
||
|
_G.dbmodel = nil
|
||
|
view.html("bot")
|
||
|
end
|
||
|
return view
|