themes/openwrt: hide modemenu if there is only one entry

This commit is contained in:
Jo-Philipp Wich 2011-09-30 18:09:03 +00:00
parent d77b837364
commit 68bf126e81
2 changed files with 12 additions and 1 deletions

View file

@ -238,6 +238,8 @@ html #menubar a:visited.warning {
color: #ffffff;
list-style: none;
margin-right: 1px;
margin-left: 2em;
float: right;
}
#modemenu li {
@ -247,7 +249,6 @@ html #menubar a:visited.warning {
#savemenu {
float: right;
margin-right: 2em;
}
.lang_de #submenu_admin_uci {

View file

@ -25,6 +25,7 @@ local node = luci.dispatcher.context.dispatched
local hostname = luci.sys.hostname()
local c = tree
local i, r
for i,r in ipairs(request) do
if c.nodes and c.nodes[r] then
c = c.nodes[r]
@ -32,6 +33,13 @@ for i,r in ipairs(request) do
end
end
local has_categories = 0
for i,r in pairs(tree.nodes) do
if r.title and not r.hidden then
has_categories = has_categories + 1
end
end
require("luci.i18n").loadc("base")
require("luci.http").prepare_content("application/xhtml+xml")
@ -138,6 +146,7 @@ require("luci.http").prepare_content("application/xhtml+xml")
</span>
</div>
<% if has_categories > 1 then %>
<ul id="modemenu"><%
for k,node in pairs(tree.nodes) do
if node.title and not node.hidden then %>
@ -146,6 +155,7 @@ for k,node in pairs(tree.nodes) do
end
%>
</ul>
<% end %>
<%
if tree.nodes[category] and tree.nodes[category].ucidata then