themes: add common class to uci change indicator

Add a common CSS class name to the change indicator and modify the openwrt.org
theme to hide it when no changes are present, similar to all other themes.

This is needed for upcoming uci apply handling changes to be able to auto-hide
the indicator without page reload after an apply.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2018-04-26 08:21:59 +02:00
parent 8459ec0ec8
commit 736d8fee47
4 changed files with 4 additions and 12 deletions

View file

@ -145,7 +145,7 @@
end
if ucichanges > 0 then
write('<a class="label notice" href="%s?redir=%s">%s: %d</a>' %{
write('<a class="uci_change_indicator" class="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'),

View file

@ -205,7 +205,7 @@ if tree.nodes[category] and tree.nodes[category].ucidata then
-%>
<div id="savemenu">
<% if ucic > 0 then %>
<a class="warning" href="<%=controller%>/<%=category%>/uci/changes/?redir=<%=http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/"))%>"><%:Unsaved Changes%>: <%=ucic%></a>
<a class="uci_change_indicator" class="warning" href="<%=controller%>/<%=category%>/uci/changes/?redir=<%=http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/"))%>"><%:Unsaved Changes%>: <%=ucic%></a>
<% end -%>
</div>
<% end %>

View file

@ -170,7 +170,7 @@
end
if ucichanges > 0 then
write('<a class="label notice" href="%s?redir=%s">%s: %d</a>' %{
write('<a class="uci_change_indicator" class="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'),

View file

@ -99,22 +99,14 @@
end
end
write('<div id="savemenu">')
if ucic > 0 then
write('<a class="warning" href="%s?redir=%s">%s: %d</a>' %{
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
})
else
write('<a href="#">%s: 0</a>' %{
translate('Unsaved Changes')
})
end
write('</div>')
end
end
-%>