diff options
-rw-r--r-- | libs/web/luasrc/http.lua | 10 | ||||
-rw-r--r-- | themes/fledermaus/luasrc/view/themes/fledermaus/header.htm | 11 | ||||
-rw-r--r-- | themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm | 13 |
3 files changed, 27 insertions, 7 deletions
diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua index fa8821c5a..68dad8f1e 100644 --- a/libs/web/luasrc/http.lua +++ b/libs/web/luasrc/http.lua @@ -33,4 +33,14 @@ if ENV and ENV.HASERLVER then require("luci.sgi.haserl") elseif webuci then require("luci.sgi.webuci") +end + +function build_querystring(table) + local s="?" + + for k, v in pairs(table) do + s = s .. k .. "=" .. v .. "&" + end + + return s end
\ No newline at end of file diff --git a/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm b/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm index 99bd39924..cb378555f 100644 --- a/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm +++ b/themes/fledermaus/luasrc/view/themes/fledermaus/header.htm @@ -73,9 +73,12 @@ local function submenu(prefix, node) %> <ul> <% for j, v in pairs(index) do - local nnode = node.nodes[v.name]%> + local nnode = node.nodes[v.name] + local href = controller .. prefix .. v.name + href = (v.query) and href .. luci.http.build_querystring(v.query) or href + %> <li> - <span<% if nnode._menu_selected then %> class="yellowtext"<%end%>><a href="<%=controller .. prefix .. v.name%>"><%=nnode.title%></a></span> + <span<% if nnode._menu_selected then %> class="yellowtext"<%end%>><a href="<%=href%>"><%=nnode.title%></a></span> <% submenu(prefix .. v.name .. "/", nnode) %> </li> <% end %> @@ -93,7 +96,9 @@ if cattree and cattree.nodes then for i, k in ipairs(index) do node = cattree.nodes[k.name] - if node.title then %> + if node.title then + local href = controller.."/"..category.."/"..k.name + href = (k.query) and href .. luci.http.build_querystring(k.query) or href %> <div<% if node._menu_selected then %> class="yellowtext"<%end%>><a href="<%=controller%>/<%=category%>/<%=k.name%>"><%=node.title%></a> <%submenu("/" .. category .. "/" .. k.name .. "/", node)%> </div> diff --git a/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm b/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm index 2ab67ecf4..4efde4a62 100644 --- a/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm +++ b/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm @@ -73,9 +73,12 @@ local function submenu(prefix, node) %> <ul> <% for j, v in pairs(index) do - local nnode = node.nodes[v.name]%> + local nnode = node.nodes[v.name] + local href = controller .. prefix .. v.name + href = (v.query) and href .. luci.http.build_querystring(v.query) or href + %> <li> - <span<% if nnode._menu_selected then %> class="blacktext"<%end%>><a href="<%=controller .. prefix .. v.name%>"><%=nnode.title%></a></span> + <span<% if nnode._menu_selected then %> class="blacktext"<%end%>><a href="<%=href%>"><%=nnode.title%></a></span> <% submenu(prefix .. v.name .. "/", nnode) %> </li> <% end %> @@ -93,8 +96,10 @@ if cattree and cattree.nodes then for i, k in ipairs(index) do node = cattree.nodes[k.name] - if node.title then %> - <div<% if node._menu_selected then %> class="blacktext"<%end%>><a href="<%=controller%>/<%=category%>/<%=k.name%>"><%=node.title%></a> + if node.title then + local href = controller.."/"..category.."/"..k.name + href = (k.query) and href .. luci.http.build_querystring(k.query) or href %> + <div<% if node._menu_selected then %> class="blacktext"<%end%>><a href="<%=href%>"><%=node.title%></a> <%submenu("/" .. category .. "/" .. k.name .. "/", node)%> </div> <% end |