mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-26 10:39:46 +02:00
apps
This commit is contained in:
12
apps/controllers/IndexController.lua
Normal file
12
apps/controllers/IndexController.lua
Normal file
@ -0,0 +1,12 @@
|
||||
BaseController:subclass("IndexController", {
|
||||
registry = {}
|
||||
})
|
||||
|
||||
function IndexController:index( ... )
|
||||
return true
|
||||
end
|
||||
|
||||
function IndexController:actionnotfound(...)
|
||||
self.template:setView("index")
|
||||
return self:index(table.unpack({...}))
|
||||
end
|
13
apps/controllers/MarkOnController.lua
Normal file
13
apps/controllers/MarkOnController.lua
Normal file
@ -0,0 +1,13 @@
|
||||
BaseController:subclass("MarkOnController", {
|
||||
registry = {}
|
||||
})
|
||||
|
||||
function MarkOnController:index( ... )
|
||||
self.template:set("jsclass", "MarkOn")
|
||||
return true
|
||||
end
|
||||
|
||||
function MarkOnController:actionnotfound(...)
|
||||
self.template:setView("index")
|
||||
return self:index(table.unpack({...}))
|
||||
end
|
@ -1,35 +0,0 @@
|
||||
BaseController:subclass("PostController", {
|
||||
registry = {},
|
||||
models = { "post" }
|
||||
})
|
||||
|
||||
function PostController:index(...)
|
||||
local args = {...}
|
||||
self:setSession("postsession", "Huehuehue")
|
||||
self.template:set("post", self.post:findAll())
|
||||
return true
|
||||
end
|
||||
|
||||
function PostController:edit(...)
|
||||
if self:getSession("postsession") then
|
||||
self.template:set("auth", true)
|
||||
else
|
||||
self.template:set("auth", false)
|
||||
end
|
||||
self:switchLayout("admin")
|
||||
return true
|
||||
end
|
||||
|
||||
function PostController:add(...)
|
||||
local args = {...}
|
||||
local m = {
|
||||
cid = tonumber(args[1]),
|
||||
content = "This is the content for #cid="..args[1]
|
||||
}
|
||||
if(self.post:create(m)) then
|
||||
self.template:set("status", "Post created")
|
||||
else
|
||||
self.template:set("status", "Cannot create post")
|
||||
end
|
||||
return true
|
||||
end
|
Reference in New Issue
Block a user