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 0441c95..7596236 100644 (file)
                        end
 
                        if ucichanges > 0 then
                        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'),
                                        url(category, 'uci/changes'),
                                        http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")),
                                        translate('Unsaved Changes'),
index 8185655..e9e8288 100644 (file)
@@ -205,7 +205,7 @@ if tree.nodes[category] and tree.nodes[category].ucidata then
 -%>
        <div id="savemenu">
                <% if ucic > 0 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 %>
                <% end -%>
        </div>
 <% end %>
index be7b9ff..3592f38 100644 (file)
                        end
 
                        if ucichanges > 0 then
                        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'),
                                        url(category, 'uci/changes'),
                                        http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")),
                                        translate('Unsaved Changes'),
index d6db8e8..a560014 100644 (file)
                                end
                        end
 
                                end
                        end
 
-                       write('<div id="savemenu">')
-
                        if ucic > 0 then
                        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
                                })
                                        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
                        end
-
-                       write('</div>')
                end
        end
 -%>
                end
        end
 -%>