X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=themes%2Fluci-theme-openwrt%2Fluasrc%2Fview%2Fthemes%2Fopenwrt.org%2Fheader.htm;h=a560014d379bb7fae8f2e40d376823346b4bdfba;hb=736d8fee4;hp=d43cc9c027049e3b0eb07155f11fee1491cc2b56;hpb=30d45d0c0e0a08725b017693460a6d70379a68ac;p=project%2Fluci.git diff --git a/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm b/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm index d43cc9c02..a560014d3 100644 --- a/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm +++ b/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm @@ -42,24 +42,24 @@ http.prepare_content("application/xhtml+xml") local function nodeurl(prefix, name, query) - local url = controller .. prefix .. name .. "/" + local u = url(prefix, name) if query then - url = url .. http.build_querystring(query) + u = u .. http.build_querystring(query) end - return pcdata(url) + return pcdata(u) end - local function subtree(prefix, node, level) + local function render_menu(prefix, node, level) if not level then level = 1 end local childs = disp.node_childs(node) if #childs > 0 then -%> -
-
') + if selected_node then - subtree(prefix .. selected_name .. "/", selected_node, level + 1) + render_menu(prefix .. "/" .. selected_name, selected_node, level + 1) + end + + write('
') + end + end + + local function render_changes() + if tree.nodes[category] and tree.nodes[category].ucidata then + local ucic = 0 + for i, j in pairs(require("luci.model.uci").cursor():changes()) do + for k, l in pairs(j) do + for m, n in pairs(l) do + ucic = ucic + 1; + end + end + end + + if ucic > 0 then + write('
%s: %d
' %{ + url(category, 'uci/changes'), + http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")), + translate('Unsaved Changes'), + ucic + }) end -%> - -<% end end -%> @@ -137,38 +158,21 @@ <% end %> -<% -if tree.nodes[category] and tree.nodes[category].ucidata then - local ucic = 0 - for i, j in pairs(require("luci.model.uci").cursor():changes()) do - for k, l in pairs(j) do - for m, n in pairs(l) do - ucic = ucic + 1; - end - end - end --%> -
- <% if ucic > 0 then %> - "><%:Unsaved Changes%>: <%=ucic%> - <%- else -%> - <%:Changes%>: 0 - <% end -%> -
<% end %> +<% render_changes() %>
- <% if category then subtree("/" .. category .. "/", cattree) end %> + <% if category then render_menu(category, cattree) end %>