From fda4ba598c0ba1c06f5de43554b40cf0d415d047 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 7 Feb 2019 19:10:34 +0100 Subject: luci-base: replace uci change pages with client side modal dialog Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/themes/rosy/header.htm | 95 ++++++++-------------- 1 file changed, 35 insertions(+), 60 deletions(-) (limited to 'themes/luci-theme-rosy/luasrc/view') diff --git a/themes/luci-theme-rosy/luasrc/view/themes/rosy/header.htm b/themes/luci-theme-rosy/luasrc/view/themes/rosy/header.htm index c10dea9dd5..c20d9c0485 100644 --- a/themes/luci-theme-rosy/luasrc/view/themes/rosy/header.htm +++ b/themes/luci-theme-rosy/luasrc/view/themes/rosy/header.htm @@ -3,7 +3,7 @@ luci-theme-rosy Copyright 2018 Rosy Song Copyright 2018 Yan Lan Shen - + Have a bug? Please create an issue here on GitHub! https://github.com/rosywrt/luci-theme-rosy/issues @@ -146,68 +146,44 @@ end end - local function render_logout() - local childs = disp.node_childs(cattree) - if #childs > 0 then - - for i, r in ipairs(childs) do - local nnode = cattree.nodes[r] - local grandchildren = disp.node_childs(nnode) - + local function render_logout() + local childs = disp.node_childs(cattree) + if #childs > 0 then + + for i, r in ipairs(childs) do + local nnode = cattree.nodes[r] + local grandchildren = disp.node_childs(nnode) + if #grandchildren <= 0 then - local title = pcdata(striptags(translate(nnode.title))) - - write('%s' %{ - title, - nodeurl(category, r, nnode.query), - title - }) - end - end - - end - end - - - local function render_changes() - -- calculate the number of unsaved changes - if tree.nodes[category] and tree.nodes[category].ucidata then - local ucichanges = 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 - ucichanges = ucichanges + 1; - end - end - end + local title = pcdata(striptags(translate(nnode.title))) + + write('%s' %{ + title, + nodeurl(category, r, nnode.query), + title + }) + end + end + + end + end - if ucichanges > 0 then - write('%s: %d' %{ - url(category, 'uci/changes'), - http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")), - translate('Unsaved Changes'), - ucichanges - }) - end - end - end local function auth_level() - local childs = disp.node_childs(cattree) + local childs = disp.node_childs(cattree) if #childs > 0 then - for i, r in ipairs(childs) do - local nnode = cattree.nodes[r] - local grandchildren = disp.node_childs(nnode) - + for i, r in ipairs(childs) do + local nnode = cattree.nodes[r] + local grandchildren = disp.node_childs(nnode) + if #grandchildren > 0 then -- If this value is returned, the current interface is the logged-in data output interface return "auth" else -- If this value is returned, it indicates that the current interface is a data output interface that does not require login. return "noauth" - end - end + end + end end -- If this value is returned, the current interface is the login interface return "login" @@ -260,7 +236,6 @@ <%=boardinfo.hostname or "?"%>
- <% render_changes() %>
- -
- -
Loading... + +
+ +
Loading...
@@ -292,10 +267,10 @@
-
- Rosy +
<%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%> -- cgit v1.2.3