summaryrefslogtreecommitdiffhomepage
path: root/core/src/cbi.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-14 12:10:44 +0000
committerSteven Barth <steven@midlink.org>2008-05-14 12:10:44 +0000
commit3f4f75b1079eb1ea29b6c2fde9a3dd25c52f2fe4 (patch)
tree21864f75a3f353720fde2118f15dd504c3a160eb /core/src/cbi.lua
parent9a8624350f9f47f5d3abbf8a7cdafea4246334d6 (diff)
* core: Added template for a table view of typed sections
Diffstat (limited to 'core/src/cbi.lua')
-rw-r--r--core/src/cbi.lua20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/src/cbi.lua b/core/src/cbi.lua
index 3384e5c38a..8a623b62c9 100644
--- a/core/src/cbi.lua
+++ b/core/src/cbi.lua
@@ -87,8 +87,11 @@ function Node.parse(self, ...)
end
-- Render this node
-function Node.render(self)
- ffluci.template.render(self.template, {self=self})
+function Node.render(self, scope)
+ scope = scope or {}
+ scope.self = self
+
+ ffluci.template.render(self.template, scope)
end
-- Render the children
@@ -453,13 +456,6 @@ function TypedSection.parse(self)
end
end
--- Render the children
-function TypedSection.render_children(self, section)
- for k, node in ipairs(self.children) do
- node:render(section)
- end
-end
-
-- Verifies scope of sections
function TypedSection.checkscope(self, section)
-- Check if we are not excluded
@@ -554,9 +550,11 @@ function AbstractValue.parse(self, section)
end
-- Render if this value exists or if it is mandatory
-function AbstractValue.render(self, s)
+function AbstractValue.render(self, s, scope)
if not self.optional or self:cfgvalue(s) or self:formcreated(s) then
- ffluci.template.render(self.template, {self=self, section=s})
+ scope = scope or {}
+ scope.section = s
+ Node.render(self, scope)
end
end