diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-26 02:17:45 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-26 02:17:45 +0000 |
commit | e12b8dbc1f8d4a0d820d89ab8ade4bc6f740bb63 (patch) | |
tree | 05076813df6ac4ce3a94d2a0c1d7997831db3f4a /libs/web/luasrc/cbi.lua | |
parent | 8c9aef1b2de7df6838b939c9eb314ad613bab3d9 (diff) |
libs/web: move ifattr() and attr() helpers into dispatcher scope to make them avilable to all templates, remove duplicate exports in cbi tempalte scope
Diffstat (limited to 'libs/web/luasrc/cbi.lua')
-rw-r--r-- | libs/web/luasrc/cbi.lua | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/libs/web/luasrc/cbi.lua b/libs/web/luasrc/cbi.lua index 86658d7020..8b9805f047 100644 --- a/libs/web/luasrc/cbi.lua +++ b/libs/web/luasrc/cbi.lua @@ -1325,29 +1325,8 @@ end function AbstractValue.render(self, s, scope) if not self.optional or self.section:has_tabs() or self:cfgvalue(s) or self:formcreated(s) then scope = scope or {} - scope.section = s - scope.cbid = self:cbid(s) - scope.striptags = luci.util.striptags - scope.pcdata = luci.util.pcdata - - scope.ifattr = function(cond,key,val) - if cond then - return string.format( - ' %s="%s"', tostring(key), - luci.util.pcdata(tostring( val - or scope[key] - or (type(self[key]) ~= "function" and self[key]) - or "" )) - ) - else - return '' - end - end - - scope.attr = function(...) - return scope.ifattr( true, ... ) - end - + scope.section = s + scope.cbid = self:cbid(s) Node.render(self, scope) end end |