From 4de35274cab2df740941149fe41c3c2bb8c12850 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 3 Mar 2016 22:06:39 +0100 Subject: [PATCH] luci-base: view: make checkboxes and radio buttons styleable Add an empty, normally invisible label after checkboxes and radio buttons with cbi-input-{checkbox,radio} classes to allow CSS styling them as suggested on http://www.paulund.co.uk/style-checkboxes-with-css Signed-off-by: Nils Schneider Signed-off-by: Matthias Schiffer --- .../luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm | 1 + .../luasrc/view/ddns/overview_enabled.htm | 1 + .../luci-base/luasrc/view/cbi/firewall_zonelist.htm | 4 ++++ modules/luci-base/luasrc/view/cbi/fvalue.htm | 1 + modules/luci-base/luasrc/view/cbi/lvalue.htm | 3 ++- modules/luci-base/luasrc/view/cbi/mvalue.htm | 3 ++- .../luci-base/luasrc/view/cbi/network_ifacelist.htm | 12 ++++++++++-- .../luci-base/luasrc/view/cbi/network_netlist.htm | 3 +++ .../luasrc/view/freifunk/remote_update.htm | 2 ++ 9 files changed, 26 insertions(+), 4 deletions(-) diff --git a/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm b/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm index 0bcfd44283..b69d780ea9 100644 --- a/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm +++ b/applications/luci-app-ddns/luasrc/view/ddns/detail_lvalue.htm @@ -14,6 +14,7 @@ c = c + 1 %> /> + > ><%=self.vallist[i]%> <% if c == self.size then c = 0 %><% if self.orientation == "horizontal" then %> <% else %>
<% end %> <% end end %> diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm index 64b3dae455..2efc125fcc 100644 --- a/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm +++ b/applications/luci-app-ddns/luasrc/view/ddns/overview_enabled.htm @@ -10,6 +10,7 @@ attr("id", cbid) .. attr("name", cbid) .. attr("value", self.enabled or 1) .. ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked") %> /> +> <%+cbi/valuefooter%> diff --git a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm index b3b454008f..5cb31511f6 100644 --- a/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm +++ b/modules/luci-base/luasrc/view/cbi/firewall_zonelist.htm @@ -28,6 +28,7 @@ <% if self.allowlocal then %>
  • />   + > style="background-color:<%=fwm.zone.get_color()%>" class="zonebadge"> <%:Device%> <% if self.allowany and self.allowlocal then %>(<%:input%>)<% end %> @@ -37,6 +38,7 @@ <% if self.allowany then %>
  • />   + > style="background-color:<%=fwm.zone.get_color()%>" class="zonebadge"> <%:Any zone%> <% if self.allowany and self.allowlocal then %>(<%:forward%>)<% end %> @@ -50,6 +52,7 @@ %>
  • />   + > style="background-color:<%=zone:get_color()%>" class="zonebadge"> <%=zone:name()%>: <% @@ -78,6 +81,7 @@ <% if self.widget ~= "checkbox" and not self.nocreate then %>
  • />   + >
    <%:unspecified -or- create:%>  onfocus="document.getElementById('<%=cbid%>_new').checked=true" /> diff --git a/modules/luci-base/luasrc/view/cbi/fvalue.htm b/modules/luci-base/luasrc/view/cbi/fvalue.htm index 5eddcf22a1..197d03cf31 100644 --- a/modules/luci-base/luasrc/view/cbi/fvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/fvalue.htm @@ -6,4 +6,5 @@ attr("id", cbid) .. attr("name", cbid) .. attr("value", self.enabled or 1) .. ifattr((self:cfgvalue(section) or self.default) == self.enabled, "checked", "checked") %> /> + > <%+cbi/valuefooter%> diff --git a/modules/luci-base/luasrc/view/cbi/lvalue.htm b/modules/luci-base/luasrc/view/cbi/lvalue.htm index 99f456dc54..34d02eeca0 100644 --- a/modules/luci-base/luasrc/view/cbi/lvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/lvalue.htm @@ -24,15 +24,16 @@
    <% for i, key in pairs(self.keylist) do %> > /> + > <%=pcdata(self.vallist[i])%> <% if i == self.size then write(br) end %> diff --git a/modules/luci-base/luasrc/view/cbi/mvalue.htm b/modules/luci-base/luasrc/view/cbi/mvalue.htm index ca7b94c15e..246ef43aad 100644 --- a/modules/luci-base/luasrc/view/cbi/mvalue.htm +++ b/modules/luci-base/luasrc/view/cbi/mvalue.htm @@ -24,15 +24,16 @@
    <% for i, key in pairs(self.keylist) do %> > /> + > <%=pcdata(self.vallist[i])%> <% if i == self.size then write('
    ') end %> diff --git a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm b/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm index db6112992a..62dbde7dd4 100644 --- a/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm +++ b/modules/luci-base/luasrc/view/cbi/network_ifacelist.htm @@ -46,7 +46,11 @@ attr("id", cbid .. "." .. iface:name()) .. attr("name", cbid) .. attr("value", iface:name()) .. ifattr(checked[iface:name()], "checked", "checked") - %> />   + %> /> + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + > + <%- end -%> +   > <% if link then -%><% end -%> style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/<%=iface:type()%><%=iface:is_up() and "" or "_disabled"%>.png" /> @@ -68,7 +72,11 @@ attr("id", cbid .. "_custom") .. attr("name", cbid) .. attr("value", " ") - %> />   + %> /> + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + > + <%- end -%> +   > <%:Custom Interface%>: diff --git a/modules/luci-base/luasrc/view/cbi/network_netlist.htm b/modules/luci-base/luasrc/view/cbi/network_netlist.htm index f8a2b72f3c..8bf1a70a20 100644 --- a/modules/luci-base/luasrc/view/cbi/network_netlist.htm +++ b/modules/luci-base/luasrc/view/cbi/network_netlist.htm @@ -52,6 +52,9 @@ <% if not self.nocreate then %>
  • " data-update="click change"<%=attr("type", self.widget or "radio") .. attr("id", cbid .. "_new") .. attr("name", cbid) .. attr("value", "-") .. ifattr(not value and self.widget ~= "checkbox", "checked", "checked")%> />   + <%- if not self.widget or self.widget == "checkbox" or self.widget == "radio" then -%> + > + <%- end -%>
    > <%- if self.widget == "checkbox" then -%> diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm index 83e1ee5792..f087472d31 100644 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm +++ b/modules/luci-mod-freifunk/luasrc/view/freifunk/remote_update.htm @@ -38,9 +38,11 @@ +
    +

    -- 2.30.2