roojs-bootstrap.js
authorAlan Knowles <alan@roojs.com>
Thu, 21 Aug 2014 09:02:15 +0000 (17:02 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 21 Aug 2014 09:02:15 +0000 (17:02 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 3eb85cd..afcf607 100644 (file)
@@ -1043,6 +1043,82 @@ Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component,  {
         this.fireEvent('click', this, e);
     }
    
+});
+
+ /*
+ * - LGPL
+ *
+ * image
+ * 
+ */
+
+
+/**
+ * @class Roo.bootstrap.Link
+ * @extends Roo.bootstrap.Component
+ * Bootstrap Link Class
+ * @cfg {String} alt image alternative text
+ * @cfg {String} href a tag href
+ * @cfg {String} target (_self|_blank|_parent|_top) target for a href.
+ * @cfg {String} html the content of the link.
+
+ * 
+ * @constructor
+ * Create a new Input
+ * @param {Object} config The config object
+ */
+
+Roo.bootstrap.Link = function(config){
+    Roo.bootstrap.Link.superclass.constructor.call(this, config);
+    
+    this.addEvents({
+        // img events
+        /**
+         * @event click
+         * The img click event for the img.
+         * @param {Roo.EventObject} e
+         */
+        "click" : true
+    });
+};
+
+Roo.extend(Roo.bootstrap.Link, Roo.bootstrap.Component,  {
+    
+    href: false,
+    target: false,
+
+    getAutoCreate : function(){
+        
+        var cfg = {
+            tag: 'a',
+            html : this.html || 'html-missing'
+        }
+        
+        
+        if(this.alt){
+            cfg.alt = this.alt;
+        }
+        cfg.href = this.href || '#';
+        if(this.target){
+            cfg.target = this.target;
+        }
+        
+        return cfg;
+    },
+    
+    initEvents: function() {
+        
+        if(!this.href){
+            this.el.on('click', this.onClick, this);
+        }
+    },
+    
+    onClick : function(e)
+    {
+        //Roo.log('img onclick');
+        this.fireEvent('click', this, e);
+    }
+   
 });
 
  /*
index a51eb94..e2c0b4d 100644 (file)
@@ -28,6 +28,9 @@ B=false;A.cn.push({cls:'panel-body',html:this.html});if(this.footer.length){A.cn
 //Roo/bootstrap/Img.js
 Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Img,Roo.bootstrap.Component,{imgResponsive:true,border:'',src:'',href:false,target:false,getAutoCreate:function(){var A={tag:'img',cls:(this.imgResponsive)?'img-responsive':'',html:null}
 A.html=this.html||A.html;A.src=this.src||A.src;if(['rounded','circle','thumbnail'].indexOf(this.border)>-1){A.cls+=' img-'+this.border;}if(this.alt){A.alt=this.alt;}if(this.href){var a={tag:'a',href:this.href,cn:[A]};if(this.target){a.target=this.target;}}return (this.href)?a:A;},initEvents:function(){if(!this.href){this.el.on('click',this.onClick,this);}},onClick:function(e){Roo.log('img onclick');this.fireEvent('click',this,e);}});
+//Roo/bootstrap/Link.js
+Roo.bootstrap.Link=function(A){Roo.bootstrap.Link.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Link,Roo.bootstrap.Component,{href:false,target:false,getAutoCreate:function(){var A={tag:'a',html:this.html||'html-missing'};if(this.alt){A.alt=this.alt;}
+A.href=this.href||'#';if(this.target){A.target=this.target;}return A;},initEvents:function(){if(!this.href){this.el.on('click',this.onClick,this);}},onClick:function(e){this.fireEvent('click',this,e);}});
 //Roo/bootstrap/Header.js
 Roo.bootstrap.Header=function(A){Roo.bootstrap.Header.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Header,Roo.bootstrap.Component,{html:false,level:1,getAutoCreate:function(){var A={tag:'h'+(1*this.level),html:this.html||'fill in html'};return A;}});
 //Roo/bootstrap/MenuMgr.js