luci2: Introduce 'add' option to LuCI2.cbi.AbstractValue.depends() to support increme...
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 1 Feb 2014 17:59:06 +0000 (17:59 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 1 Feb 2014 17:59:06 +0000 (17:59 +0000)
luci2/htdocs/luci2/luci2.js

index 6e66128d8fb23d367d3ac0dda2126d2a376f1447..00365ae2cc593533ad3b1115a92cfcf469494e31 100644 (file)
@@ -5240,7 +5240,7 @@ function LuCI2()
                        return (i.disabled || i.error.text() == '');
                },
 
-               depends: function(d, v)
+               depends: function(d, v, add)
                {
                        var dep;
 
@@ -5285,7 +5285,11 @@ function LuCI2()
                        if ($.isEmptyObject(dep))
                                return this;
 
-                       this.dependencies.push(dep);
+                       if (!add || !this.dependencies.length)
+                               this.dependencies.push(dep);
+                       else
+                               for (var i = 0; i < this.dependencies.length; i++)
+                                       $.extend(this.dependencies[i], dep);
 
                        return this;
                },