themes/openwrt: hide modemenu if there is only one entry
[project/luci.git] / themes / openwrt / luasrc / view / themes / openwrt.org / header.htm
index c401a12e6b2f8dd6b887dbdff00769e681a2f549..ea9ce02f27c6404b3b14804ca6d9c14643f5668b 100644 (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