luci2: implement LuCI2.cbi.ButtonValue widget
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 31 Jan 2014 21:44:49 +0000 (21:44 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 31 Jan 2014 21:44:49 +0000 (21:44 +0000)
luci2/htdocs/luci2/luci2.js

index fe73a951483f696ee7e5f2d40aa45ab124eebbdc..fc3c3fc7eef8a955f67be77b2593743ad8aa10ab 100644 (file)
@@ -5915,6 +5915,21 @@ function LuCI2()
                }
        });
 
+       this.cbi.ButtonValue = this.cbi.AbstractValue.extend({
+               widget: function(sid)
+               {
+                       this.options.optional = true;
+
+                       var btn = $('<button />')
+                               .addClass('btn btn-default')
+                               .attr('id', this.id(sid))
+                               .attr('type', 'button')
+                               .text(this.label('text'));
+
+                       return this.validator(sid, btn);
+               }
+       });
+
        this.cbi.NetworkList = this.cbi.AbstractValue.extend({
                load: function(sid)
                {