luci-0.10: merge r7851
This commit is contained in:
parent
0dd60c237b
commit
206146b65f
1 changed files with 6 additions and 4 deletions
|
@ -284,13 +284,15 @@ function dispatch(request)
|
||||||
assert(media, "No valid theme found")
|
assert(media, "No valid theme found")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ifattr(cond, key, val)
|
local function _ifattr(cond, key, val)
|
||||||
if cond then
|
if cond then
|
||||||
local env = getfenv(1)
|
local env = getfenv(3)
|
||||||
|
local scope = (type(env.self) == "table") and env.self
|
||||||
return string.format(
|
return string.format(
|
||||||
' %s="%s"', tostring(key),
|
' %s="%s"', tostring(key),
|
||||||
luci.util.pcdata(tostring( val
|
luci.util.pcdata(tostring( val
|
||||||
or (type(env[key]) ~= "function" and env[key])
|
or (type(env[key]) ~= "function" and env[key])
|
||||||
|
or (scope and type(scope[key]) ~= "function" and scope[key])
|
||||||
or "" ))
|
or "" ))
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
@ -308,8 +310,8 @@ function dispatch(request)
|
||||||
media = media;
|
media = media;
|
||||||
theme = fs.basename(media);
|
theme = fs.basename(media);
|
||||||
resource = luci.config.main.resourcebase;
|
resource = luci.config.main.resourcebase;
|
||||||
ifattr = ifattr;
|
ifattr = function(...) return _ifattr(...) end;
|
||||||
attr = function(...) return ifattr(true, ...) end
|
attr = function(...) return _ifattr(true, ...) end;
|
||||||
}, {__index=function(table, key)
|
}, {__index=function(table, key)
|
||||||
if key == "controller" then
|
if key == "controller" then
|
||||||
return build_url()
|
return build_url()
|
||||||
|
|
Loading…
Reference in a new issue