libs/web: cbi: provide a "last_child" property to allow for more layout control in form rendering

This commit is contained in:
Jo-Philipp Wich 2011-09-22 16:33:28 +00:00
parent 362c84480a
commit 96dd29753c

View file

@ -211,7 +211,9 @@ end
-- Render the children
function Node.render_children(self, ...)
local k, node
for k, node in ipairs(self.children) do
node.last_child = (k == #self.children)
node:render(...)
end
end
@ -805,7 +807,9 @@ function AbstractSection.render_tab(self, tab, ...)
assert(tab and self.tabs and self.tabs[tab],
"Cannot render not existing tab %q" % tostring(tab))
for _, node in ipairs(self.tabs[tab].childs) do
local k, node
for k, node in ipairs(self.tabs[tab].childs) do
node.last_child = (k == #self.tabs[tab].childs)
node:render(...)
end
end