diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-10-13 23:59:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-10-13 23:59:50 +0000 |
commit | 5ce9bd5fc852ddacb99161fc35839c3a5fbe916d (patch) | |
tree | 82c5fdcbb6c7b5aab4b00672a4048ab6fa6aab49 | |
parent | 42e1f743b394c95637b99feac7a93161c5215381 (diff) |
libs/cbi: support horizontal display for radio button groups
-rw-r--r-- | libs/cbi/luasrc/view/cbi/full_valuefooter.htm | 2 | ||||
-rw-r--r-- | libs/cbi/luasrc/view/cbi/lvalue.htm | 2 | ||||
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/libs/cbi/luasrc/view/cbi/full_valuefooter.htm b/libs/cbi/luasrc/view/cbi/full_valuefooter.htm index 9fc5c13c9..bdf7d1bfd 100644 --- a/libs/cbi/luasrc/view/cbi/full_valuefooter.htm +++ b/libs/cbi/luasrc/view/cbi/full_valuefooter.htm @@ -14,7 +14,7 @@ $Id$ -%> <% if self.description and #self.description > 0 then -%> - <% if not luci.util.instanceof( self, luci.cbi.Flag ) then -%> + <% if not luci.util.instanceof( self, luci.cbi.Flag ) or self.orientation ~= "horizontal" then -%> <br /> <%- end %> <div class="cbi-value-description"> diff --git a/libs/cbi/luasrc/view/cbi/lvalue.htm b/libs/cbi/luasrc/view/cbi/lvalue.htm index a6fd18f4f..b69934a0f 100644 --- a/libs/cbi/luasrc/view/cbi/lvalue.htm +++ b/libs/cbi/luasrc/view/cbi/lvalue.htm @@ -26,7 +26,7 @@ $Id$ %> <input class="cbi-input-radio" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)" type="radio"<%= attr("id", cbid..c) .. attr("name", cbid) .. attr("value", key) .. ifattr(self:cfgvalue(section) == key, "checked", "checked") %> /> <label<%= attr("for", cbid..c) %>><%=self.vallist[i]%></label> -<% if c == self.size then c = 0 %><br /> +<% if c == self.size then c = 0 %><% if self.orientation == "horizontal" then %> <% else %><br /><% end %> <% end end %> <% end %> <%+cbi/valuefooter%> diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index 63c23441e..7217cb371 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -70,11 +70,11 @@ end if hwtype == "mac80211" then tp = s:taboption("general", - (#tx_powers > 0) and ListValue or Value, + (tx_powers and #tx_powers > 0) and ListValue or Value, "txpower", translate("a_w_txpwr"), "dBm") tp.rmempty = true - for _, p in ipairs(iw.txpwrlist) do + for _, p in ipairs(iw and iw.txpwrlist or {}) do tp:value(p.dbm, "%i dBm (%i mW)" %{ p.dbm, p.mw }) end end @@ -107,6 +107,7 @@ if hwtype == "atheros" then if not nsantenna then ant1 = s:taboption("advanced", ListValue, "txantenna", translate("wifi_txantenna")) ant1.widget = "radio" + ant1.orientation = "horizontal" ant1:depends("diversity", "") ant1:value("0", translate("wifi_auto")) ant1:value("1", translate("wifi_ant1", "Antenna 1")) @@ -114,6 +115,7 @@ if hwtype == "atheros" then ant2 = s:taboption("advanced", ListValue, "rxantenna", translate("wifi_rxantenna")) ant2.widget = "radio" + ant2.orientation = "horizontal" ant2:depends("diversity", "") ant2:value("0", translate("wifi_auto")) ant2:value("1", translate("wifi_ant1", "Antenna 1")) |