mirror of
https://github.com/openwrt/luci.git
synced 2026-01-09 22:51:01 +04:00
luci-base: replace uci change pages with client side modal dialog
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
@@ -2049,6 +2049,10 @@ div.cbi-value var,
|
||||
color: #0069d6;
|
||||
}
|
||||
|
||||
#modal_overlay > .modal.uci-dialog {
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.uci-change-list {
|
||||
line-height: 170%;
|
||||
white-space: pre;
|
||||
@@ -2111,8 +2115,8 @@ div.cbi-value var,
|
||||
.uci-change-legend-label > var {
|
||||
float: left;
|
||||
margin-right: 4px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -130,27 +130,6 @@
|
||||
write('</ul>')
|
||||
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
|
||||
|
||||
local i, j
|
||||
for i, j in pairs(require("luci.model.uci").cursor():changes()) do
|
||||
ucichanges = ucichanges + #j
|
||||
end
|
||||
|
||||
if ucichanges > 0 then
|
||||
write('<a class="uci_change_indicator label notice" href="%s?redir=%s">%s: %d</a>' %{
|
||||
url(category, 'uci/changes'),
|
||||
http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")),
|
||||
translate('Unsaved Changes'),
|
||||
ucichanges
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
-%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%=luci.i18n.context.lang%>">
|
||||
@@ -179,7 +158,6 @@
|
||||
<a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
|
||||
<% render_topmenu() %>
|
||||
<div class="pull-right">
|
||||
<% render_changes() %>
|
||||
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||
<span class="label success" id="xhr_poll_status_on"><%:Auto Refresh%> <%:on%></span>
|
||||
<span class="label" id="xhr_poll_status_off" style="display:none"><%:Auto Refresh%> <%:off%></span>
|
||||
|
||||
@@ -155,26 +155,6 @@
|
||||
write('</ul>')
|
||||
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
|
||||
local i, j
|
||||
for i, j in pairs(require("luci.model.uci").cursor():changes()) do
|
||||
ucichanges = ucichanges + #j
|
||||
end
|
||||
|
||||
if ucichanges > 0 then
|
||||
write('<a class="uci_change_indicator label notice" href="%s?redir=%s">%s: %d</a>' %{
|
||||
url(category, 'uci/changes'),
|
||||
http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")),
|
||||
translate('Unsaved Changes'),
|
||||
ucichanges
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
-%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%=luci.i18n.context.lang%>">
|
||||
@@ -209,7 +189,6 @@
|
||||
<a id="logo" href="<%=url("admin/status/overview")%>"><img src="<%=media%>/brand.png" alt="OpenWrt"></a>
|
||||
<a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
|
||||
<div class="status">
|
||||
<% render_changes() %>
|
||||
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||
<span class="label success" id="xhr_poll_status_on"><span class="mobile-hide"><%:Auto Refresh%></span> <%:on%></span>
|
||||
<span class="label" id="xhr_poll_status_off" style="display:none"><span class="mobile-hide"><%:Auto Refresh%></span> <%:off%></span>
|
||||
|
||||
@@ -125,25 +125,6 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function render_changes()
|
||||
if tree.nodes[category] and tree.nodes[category].ucidata then
|
||||
local ucic = 0
|
||||
local i, j
|
||||
for i, j in pairs(require("luci.model.uci").cursor():changes()) do
|
||||
ucic = ucic + #j
|
||||
end
|
||||
|
||||
if ucic > 0 then
|
||||
write('<div id="savemenu" class="uci_change_indicator"><a class="warning" href="%s?redir=%s">%s: %d</a></div>' %{
|
||||
url(category, 'uci/changes'),
|
||||
http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")),
|
||||
translate('Unsaved Changes'),
|
||||
ucic
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
-%>
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
@@ -234,8 +215,6 @@
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% render_changes() %>
|
||||
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
luci-theme-rosy
|
||||
Copyright 2018 Rosy Song <rosysong@rosinson.com>
|
||||
Copyright 2018 Yan Lan Shen <yanlan.shen@rosinson.com>
|
||||
|
||||
|
||||
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('<span class="label logout"><a data-title="%s" href="%s">%s</a></span>' %{
|
||||
title,
|
||||
nodeurl(category, r, nnode.query),
|
||||
title
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
local title = pcdata(striptags(translate(nnode.title)))
|
||||
|
||||
write('<span class="label logout"><a data-title="%s" href="%s">%s</a></span>' %{
|
||||
title,
|
||||
nodeurl(category, r, nnode.query),
|
||||
title
|
||||
})
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
if ucichanges > 0 then
|
||||
write('<a class="uci_change_indicator label notice" href="%s?redir=%s"><span class="mobile-hide">%s:</span> %d</a>' %{
|
||||
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 @@
|
||||
<span class="showSide"></span>
|
||||
<a class="brand PC-hide" href="#"><%=boardinfo.hostname or "?"%></a>
|
||||
<div class="btn-con pull-right">
|
||||
<% render_changes() %>
|
||||
<span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
|
||||
<span class="label success" id="xhr_poll_status_on"><span class="mobile-hide">
|
||||
<%:Auto Refresh%></span>
|
||||
@@ -274,10 +249,10 @@
|
||||
</div>
|
||||
</header>
|
||||
<div style="" class="loading">
|
||||
<span>
|
||||
<div class="loading-img">
|
||||
<img src="<%=media%>/loading.svg">
|
||||
</div>Loading...
|
||||
<span>
|
||||
<div class="loading-img">
|
||||
<img src="<%=media%>/loading.svg">
|
||||
</div>Loading...
|
||||
</span>
|
||||
</div>
|
||||
<div class="main">
|
||||
@@ -292,10 +267,10 @@
|
||||
</div>
|
||||
<div class="main-right">
|
||||
<div id="maincontent">
|
||||
<div class="logoImg">
|
||||
<img class="mobile-hide" src="<%=media%>/logo.png" alt="Rosy">
|
||||
<div class="logoImg">
|
||||
<img class="mobile-hide" src="<%=media%>/logo.png" alt="Rosy">
|
||||
<img src="<%=media%>/mobile-loginBG.png" class="PC-hide">
|
||||
<a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
|
||||
<a class="brand" href="#"><%=boardinfo.hostname or "?"%></a>
|
||||
</div>
|
||||
<div class="container">
|
||||
<%- if luci.sys.process.info("uid") == 0 and luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%>
|
||||
|
||||
Reference in New Issue
Block a user