gluon-web-model: add Section:element and Element, add Warning template
This commit is contained in:
parent
4d61bc1bfa
commit
30a6b76520
@ -0,0 +1,14 @@
|
||||
<%- if self.title or self.content then -%>
|
||||
<div class="gluon-warning"<%=
|
||||
attr("id", id) ..
|
||||
attr("data-index", self.index) ..
|
||||
attr("data-depends", self:deplist(self.deps))
|
||||
%>>
|
||||
<%- if self.content then -%>
|
||||
<%=self.content%>
|
||||
<%- else -%>
|
||||
<b><%=self.title%></b><br>
|
||||
<%=self.description%>
|
||||
<%- end -%>
|
||||
</div>
|
||||
<%- end -%>
|
@ -196,7 +196,6 @@ function Template:__init__(template)
|
||||
self.template = template
|
||||
end
|
||||
|
||||
|
||||
local AbstractValue = class(Node)
|
||||
M.AbstractValue = AbstractValue
|
||||
|
||||
@ -411,6 +410,25 @@ function TextValue:__init__(...)
|
||||
end
|
||||
|
||||
|
||||
local Element = class(Node)
|
||||
M.Element = Element
|
||||
|
||||
function Element:__init__(template, kv, ...)
|
||||
Node.__init__(self, ...)
|
||||
|
||||
self.default = nil
|
||||
self.size = nil
|
||||
self.optional = false
|
||||
|
||||
self.template = template
|
||||
|
||||
for key, value in pairs(kv) do
|
||||
self[key] = value
|
||||
end
|
||||
|
||||
self.error = false
|
||||
end
|
||||
|
||||
local Section = class(Node)
|
||||
M.Section = Section
|
||||
|
||||
@ -427,6 +445,11 @@ function Section:option(t, ...)
|
||||
return obj
|
||||
end
|
||||
|
||||
function Section:element(...)
|
||||
local obj = Element(...)
|
||||
self:append(obj)
|
||||
return obj
|
||||
end
|
||||
|
||||
local Form = class(Node)
|
||||
M.Form = Form
|
||||
|
Loading…
Reference in New Issue
Block a user