gluon-web-model: reorder Node arguments so Section:option() can just pass them through

This commit is contained in:
Matthias Schiffer 2018-08-19 12:23:35 +02:00
parent 653c132013
commit 9a732f30dd
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -43,7 +43,7 @@ end
Node = class() Node = class()
function Node:__init__(title, description, name) function Node:__init__(name, title, description)
self.children = {} self.children = {}
self.title = title or "" self.title = title or ""
self.description = description or "" self.description = description or ""
@ -117,8 +117,8 @@ end
Form = class(Node) Form = class(Node)
function Form:__init__(...) function Form:__init__(title, description, name)
Node.__init__(self, ...) Node.__init__(self, name, title, description)
self.template = "model/form" self.template = "model/form"
end end
@ -169,15 +169,15 @@ end
Section = class(Node) Section = class(Node)
function Section:__init__(...) function Section:__init__(title, description, name)
Node.__init__(self, ...) Node.__init__(self, name, title, description)
self.template = "model/section" self.template = "model/section"
end end
function Section:option(t, option, title, description, ...) function Section:option(t, ...)
assert(instanceof(t, AbstractValue), "class must be a descendant of AbstractValue") assert(instanceof(t, AbstractValue), "class must be a descendant of AbstractValue")
local obj = t(title, description, option, ...) local obj = t(...)
self:append(obj) self:append(obj)
return obj return obj
end end
@ -185,8 +185,8 @@ end
AbstractValue = class(Node) AbstractValue = class(Node)
function AbstractValue:__init__(option, ...) function AbstractValue:__init__(...)
Node.__init__(self, option, ...) Node.__init__(self, ...)
self.deps = {} self.deps = {}
self.default = nil self.default = nil