[luci] [PATCH] ddns: 'update_url' depends on 'service_name'

Benoît Knecht benoit.knecht at gmail.com
Thu Apr 1 11:42:41 CEST 2010


Only display the 'update_url' option if 'service_name' is not defined
(shows up as '-- custom --' in the drop-down list). Also add the new
string to the ddns translation template.
---

This should do exactly what you suggested. Should be applied on top of
"ddns: make 'service_name' a ListValue" further up in this thread.

Benoît Knecht
---

diff --git a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua
index ada0ee1..638ec13 100644
--- a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua
+++ b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua
@@ -43,6 +43,10 @@ local v
 for _, v in luci.util.vspairs(services) do
 	svc:value(v)
 end
+svc:value("", "-- "..translate("custom").." --")
+
+uurl = s:option(Value, "update_url", translate("Custom Update-URL"))
+uurl:depends("service_name", "")
 
 
 s:option(Value, "domain", translate("Hostname")).rmempty = true
@@ -79,7 +83,6 @@ else
 	web:depends("ip_source", "web")
 	web.rmempty = true
 
-	s:option(Value, "update_url", translate("Custom Update-URL")).optional = true
 end
 
 
diff --git a/po/templates/ddns.pot b/po/templates/ddns.pot
index 74ffd87..ffe78c8 100644
--- a/po/templates/ddns.pot
+++ b/po/templates/ddns.pot
@@ -44,3 +44,6 @@ msgstr ""
 #: applications/luci-ddns/luasrc/i18n/ddns.en.lua:8
 msgid "Custom Update-URL"
 msgstr ""
+
+msgid "custom"
+msgstr ""
-- 
1.7.0.3



More information about the luci mailing list