luci-app-travelmate: bring back cbi element to wifi_add.lua 1730/head
authorDirk Brenken <dev@brenken.org>
Fri, 6 Apr 2018 16:34:41 +0000 (18:34 +0200)
committerDirk Brenken <dev@brenken.org>
Fri, 6 Apr 2018 16:34:41 +0000 (18:34 +0200)
b00b676 fixed the cbi initialization for SimpleForm, therefore bring
  back "Ignore BSSID" flag with dependent input field

Signed-off-by: Dirk Brenken <dev@brenken.org>
applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua

index f1adae2..83011e9 100644 (file)
@@ -34,15 +34,19 @@ end
 wssid.datatype = "rangelength(1,32)"
 wssid.default = m.hidden.ssid or ""
 
 wssid.datatype = "rangelength(1,32)"
 wssid.default = m.hidden.ssid or ""
 
-bssid = m:field(Value, "bssid", translate("BSSID"),
-       translatef("The BSSID information '%s' is optional and only required for hidden networks", m.hidden.bssid or ""))
-bssid.datatype = "macaddr"
+nobssid = m:field(Flag, "no_bssid", translate("Ignore BSSID"))
 if m.hidden.ssid == "" then
 if m.hidden.ssid == "" then
-       bssid.default = m.hidden.bssid or ""
+       nobssid.default = nobssid.disabled
 else
 else
-       bssid.default = ""
+       nobssid.default = nobssid.enabled
 end
 
 end
 
+bssid = m:field(Value, "bssid", translate("BSSID"),
+       translatef("The BSSID information '%s' is optional and only required for hidden networks", m.hidden.bssid or ""))
+bssid:depends("no_bssid", 0)
+bssid.datatype = "macaddr"
+bssid.default = m.hidden.bssid or ""
+
 if (tonumber(m.hidden.wep) or 0) == 1 then
        encr = m:field(ListValue, "encryption", translate("Encryption"))
        encr:value("wep", "WEP")
 if (tonumber(m.hidden.wep) or 0) == 1 then
        encr = m:field(ListValue, "encryption", translate("Encryption"))
        encr:value("wep", "WEP")