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.html("top")
local path = BLOG_ROOT.."/view"
local fn = nil
local e
if action == "id" then
_G.dbmodel = data[0]
doscript(path.."/detail.ls")
fn, e = loadscript(path.."/detail.ls")
else
_G.dbmodel = { data = data, order = sort }
doscript(path.."/entries.ls")
fn, e = loadscript(path.."/entries.ls")
end
if fn then
fn(data, sort)
else
echo(e)
end
_G.dbmodel = nil
view.html("bot")
end
return view

View File

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

View File

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