From 826585bf46c688969341e5119c404eed756c7dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Sat, 28 May 2022 08:52:46 +0200 Subject: [PATCH] fixup! webmodel add element type --- .../usr/lib/lua/gluon/web/model/classes.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/package/gluon-web-model/luasrc/usr/lib/lua/gluon/web/model/classes.lua b/package/gluon-web-model/luasrc/usr/lib/lua/gluon/web/model/classes.lua index 7f704f5f..64b15b25 100644 --- a/package/gluon-web-model/luasrc/usr/lib/lua/gluon/web/model/classes.lua +++ b/package/gluon-web-model/luasrc/usr/lib/lua/gluon/web/model/classes.lua @@ -410,6 +410,21 @@ function TextValue:__init__(...) end +local Element = class(Node) +M.Element = Element + +function Element:__init__(template, ...) + Node.__init__(self, ...) + + self.default = nil + self.size = nil + self.optional = false + + self.template = template + + self.error = false +end + local Section = class(Node) M.Section = Section @@ -426,8 +441,8 @@ function Section:option(t, ...) return obj end -function Section:template(...) - local obj = Template(...) +function Section:element(...) + local obj = Element(...) self:append(obj) return obj end