Roo/bootstrap/Button.js
[roojs1] / Roo / bootstrap / Button.js
index 8116036..a578c6e 100644 (file)
@@ -10,7 +10,8 @@
  * @extends Roo.bootstrap.Component
  * Bootstrap Button class
  * @cfg {String} html The button content
- * @cfg {String} weight (default | primary | success | info | warning | danger | link ) default 
+ * @cfg {String} weight (default | primary | secondary | success | info | warning | danger | link ) default
+ * @cfg {Boolean} outline default false (except for weight=default which emulates old behaveiour with an outline)
  * @cfg {String} size ( lg | sm | xs)
  * @cfg {String} tag ( a | input | submit)
  * @cfg {String} href empty or href
@@ -36,7 +37,7 @@
 
 Roo.bootstrap.Button = function(config){
     Roo.bootstrap.Button.superclass.constructor.call(this, config);
-    this.weightClass = ["btn-default", 
+    this.weightClass = ["btn-default btn-outline-secondary", 
                        "btn-primary", 
                        "btn-success", 
                        "btn-info", 
@@ -68,6 +69,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
     html: false,
     active: false,
     weight: '',
+    outline : false,
     size: '',
     tag: 'button',
     href: '',
@@ -121,7 +123,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
                 ]
             };
             
-            if (['default', 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
+            if (['default', 'secondary' , 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
                 cfg.cls += ' '+this.weight;
             }
             
@@ -147,7 +149,8 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
             //}
             if (['default', 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
                 
-                cfg.cls += ' btn-' + this.weight;
+                var outline = this.outline || this.weight == 'default' ? 'outline-' : '';
+                cfg.cls += ' btn-' + outline + this.weight;
             }
         } else if (this.theme==='glow') {
             
@@ -374,8 +377,14 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
     
     setWeight : function(str)
     {
-       this.el.removeClass(this.weightClass);
-        this.el.addClass('btn-' + str);        
+       this.weight = str;
+        var outline = this.outline ? 'outline-' : '';
+        if (str == 'default') {
+            outline = 'outline-';
+            str = 'secondary';
+        }
+        this.el.removeClass(this.weightClass);
+        this.el.addClass('btn-' + outline + str);        
     }