From: Jo-Philipp Wich Date: Sat, 1 Feb 2014 17:59:06 +0000 (+0000) Subject: luci2: Introduce 'add' option to LuCI2.cbi.AbstractValue.depends() to support increme... X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci2%2Fui.git;a=commitdiff_plain;h=8f18cd5ef6869ab434fbe0fb002cb97fd34d3543 luci2: Introduce 'add' option to LuCI2.cbi.AbstractValue.depends() to support incrementally adding dependencies --- diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js index 6e66128..00365ae 100644 --- a/luci2/htdocs/luci2/luci2.js +++ b/luci2/htdocs/luci2/luci2.js @@ -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; },