From 68bf126e8144aa89a9915d6fd940b7c4cecfc76f Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 30 Sep 2011 18:09:03 +0000 Subject: [PATCH] themes/openwrt: hide modemenu if there is only one entry --- themes/openwrt/htdocs/luci-static/openwrt.org/cascade.css | 3 ++- themes/openwrt/luasrc/view/themes/openwrt.org/header.htm | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/themes/openwrt/htdocs/luci-static/openwrt.org/cascade.css b/themes/openwrt/htdocs/luci-static/openwrt.org/cascade.css index 64bc5bd9b..8fb5fcbb0 100644 --- a/themes/openwrt/htdocs/luci-static/openwrt.org/cascade.css +++ b/themes/openwrt/htdocs/luci-static/openwrt.org/cascade.css @@ -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 { diff --git a/themes/openwrt/luasrc/view/themes/openwrt.org/header.htm b/themes/openwrt/luasrc/view/themes/openwrt.org/header.htm index c401a12e6..ea9ce02f2 100644 --- a/themes/openwrt/luasrc/view/themes/openwrt.org/header.htm +++ b/themes/openwrt/luasrc/view/themes/openwrt.org/header.htm @@ -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") +<% if has_categories > 1 then %> +<% end %> <% if tree.nodes[category] and tree.nodes[category].ucidata then -- 2.11.0