themes: add common class to uci change indicator
authorJo-Philipp Wich <jo@mein.io>
Thu, 26 Apr 2018 06:21:59 +0000 (08:21 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 26 Apr 2018 06:26:30 +0000 (08:26 +0200)
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>
themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm
themes/luci-theme-freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm
themes/luci-theme-material/luasrc/view/themes/material/header.htm
themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm

index 0441c9583e35558bd3b20de0202c227e7245f09c..7596236a6eb09b2524fd41c087f61cc1c82bef4d 100644 (file)
                        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'),
index 81856552858e3108c442222a127bca1a69451dcd..e9e8288e0bc4ac853b250094b311370691db374d 100644 (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 %>
index be7b9ffb85e3c45d54bf68ad5c7c45537cb4e8bd..3592f38737008a82be230ef7da52d46635c97cb6 100644 (file)
                        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'),
index d6db8e885e717b00bb6282e9ff21787294bb55fb..a560014d379bb7fae8f2e40d376823346b4bdfba 100644 (file)
                                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
 -%>