1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00

change doscript to loadscript

This commit is contained in:
Xuan Sang LE 2018-02-24 19:14:46 +01:00
parent 0f36fff4eb
commit 3e809b03c6
3 changed files with 21 additions and 11 deletions

View File

@ -14,14 +14,18 @@ end
view.render = function(action, data, sort) view.render = function(action, data, sort)
view.html("top") view.html("top")
local path = BLOG_ROOT.."/view" local path = BLOG_ROOT.."/view"
local fn = nil
local e
if action == "id" then if action == "id" then
_G.dbmodel = data[0] fn, e = loadscript(path.."/detail.ls")
doscript(path.."/detail.ls")
else else
_G.dbmodel = { data = data, order = sort } fn, e = loadscript(path.."/entries.ls")
doscript(path.."/entries.ls") end
if fn then
fn(data, sort)
else
echo(e)
end end
_G.dbmodel = nil
view.html("bot") view.html("bot")
end end
return view return view

View File

@ -1,6 +1,8 @@
<?lua <?lua
local data = _G.dbmodel local arg = {...}
if not #data then local data = arg[1]
local order = arg[2]
if not #data or #order == 0 then
?> ?>
<div class = "notfound"> <div class = "notfound">
<p>No entry found</p> <p>No entry found</p>
@ -11,6 +13,8 @@
</div> </div>
<?lua <?lua
return return
else
data = data[0]
end end
?> ?>

View File

@ -1,6 +1,8 @@
<?lua <?lua
local model = _G.dbmodel local arg = {...}
if #model.order == 0 then local datas = arg[1]
local order = arg[2]
if #order == 0 then
?> ?>
<div class = "notfound"> <div class = "notfound">
<p>No entry found</p> <p>No entry found</p>
@ -13,8 +15,8 @@
return return
end end
for idx,v in pairs(model.order) do for idx,v in pairs(order) do
local data = model.data[v] local data = datas[v]
?> ?>
<div class = "card"> <div class = "card">
<div class = "side"> <div class = "side">